A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud

Overview

dittorm-deno

A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud. Ported from walinejs/dittorm

WARNING: Currently, only leancloud and deta are supported.

Quick Start

import dittorm from "https://deno.land/x/dittorm/mod.ts";

const userModel = dittorm("leancloud")("user", {
  appId: "xxx",
  appKey: "xxx",
  masterKey: "xxx",
});
const user = await userModel.add({
  username: "lizheming",
  email: "[email protected]",
});
const findUser = await user.select({ email: "[email protected]" });

Documentation

Configuration

LeanCloud

import dittorm from "https://deno.land/x/dittorm/mod.ts";

const userModel = dittorm("leancloud")("user", {
  appId: "xxx",
  appKey: "xxx",
  masterKey: "xxx",
});
Name Required Default Description
appId
appKey
masterKey

Deta

import dittorm from "https://deno.land/x/dittorm/mod.ts";

const userModel = dittorm("deta")("user", {
  projectKey: 'xxx'
});
Name Required Default Description
projectKey Deta project secret key

TODO

API

add(data)

Save store data.

const data = await userModel.add({
  username: "lizheming",
  email: "[email protected]",
});
console.log(data.id);

select(where, options)

Find store data by condition.

'2022-01-01 00:00:00'; const data = await userModel.select({ username: [">", "2022-01-01 00:00:00"] }); // SELECT * FROM user WHERE username IN ('lizheming', 'michael'); const data = await userModel.select({ username: ["IN", ["lizheming", "michael"]], }); // SELECT * FROM user WHERE username NOT IN ('lizheming', 'michael'); const data = await userModel.select({ username: ["NOT IN", ["lizheming", "michael"]], }); // SELECT * FROM user WHERE username LIKE '%li%'; const data = await userModel.select({ username: ["LIKE", "%li%"] }); // SELECT * FROM user WHERE username = 'lizheming' AND create_time > '2022-01-01 00:00:00'; const data = await userModel.select({ username: "lizheming", create_time: [">", "2022-01-01 00:00:00"], }); // SELECT * FROM user WHERE username = 'lizheming' OR create_time > '2022-01-01 00:00:00'; const data = await userModel.select({ _complex: { username: "lizheming", create_time: [">", "2022-01-01 00:00:00"], _logic: "or", }, });">
// SELECT * FROM user WHERE username = 'lizheming';
const data = await userModel.select({ username: "lizheming" });

// SELECT email FROM user WHERE username = 'lizheming' ORDER BY email DESC LIMIT 1 OFFSET 1;
const data = await userModel.select({ username: "lizheming" }, {
  field: ["email"],
  desc: "email",
  limit: 1,
  offset: 1,
});

// SELECT * FROM user WHERE username != 'lizheming';
const data = await userModel.select({ username: ["!=", "lizheming"] });

// SELECT * FROM user WHERE create_time > '2022-01-01 00:00:00';
const data = await userModel.select({ username: [">", "2022-01-01 00:00:00"] });

// SELECT * FROM user WHERE username IN ('lizheming', 'michael');
const data = await userModel.select({
  username: ["IN", ["lizheming", "michael"]],
});

// SELECT * FROM user WHERE username NOT IN ('lizheming', 'michael');
const data = await userModel.select({
  username: ["NOT IN", ["lizheming", "michael"]],
});

// SELECT * FROM user WHERE username LIKE '%li%';
const data = await userModel.select({ username: ["LIKE", "%li%"] });

// SELECT * FROM user WHERE username = 'lizheming' AND create_time > '2022-01-01 00:00:00';
const data = await userModel.select({
  username: "lizheming",
  create_time: [">", "2022-01-01 00:00:00"],
});

// SELECT * FROM user WHERE username = 'lizheming' OR create_time > '2022-01-01 00:00:00';
const data = await userModel.select({
  _complex: {
    username: "lizheming",
    create_time: [">", "2022-01-01 00:00:00"],
    _logic: "or",
  },
});

update(data, where)

Update store data by condition. where format same as select(where, options).

count(where)

Return store data count by condition. where format same as select(where, options).

delete(where)

Clean store data by condition. where format same as select(where, options).

Types

See Here.

You might also like...

PouchDB for Deno, leveraging polyfill for IndexedDB based on SQLite.

PouchDB for Deno PouchDB for Deno, leveraging polyfill for IndexedDB based on SQLite. Usage import PouchDB from 'https://deno.land/x/[email protected]

Aug 2, 2022

A Feathers service adapter for Prisma ORM.

feathers-prisma A Feathers service adapter for Prisma ORM. Installation npm install feathers-prisma --save Documentation This adapter supports all me

Dec 9, 2022

Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno

Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno

🚀 Fastest full-featured node & deno client 🏷 ES6 Tagged Template Strings at the core 🏄‍♀️ Simple surface API 🖊️ Dynamic query support 💬 Chat and

Jan 1, 2023

Deno + PostgreSQL = DenoGres

DenoGres Import Path: https://raw.githubusercontent.com/oslabs-beta/DenoGres/dev/mod.ts To install CLI: deno install --allow-read --allow-write --allo

Dec 29, 2022

Fastest JavaScript client for MySQL, with Deno FFI.

Fastest JavaScript client for MySQL, with Deno FFI.

mysql-native The fastest [1] JavaScript MySQL client. import { Connection } from "https://deno.land/x/mysql_native/mod.ts"; const conn = new Connectio

Sep 27, 2022

Deno + PostgreSQL = DenoGres

Deno + PostgreSQL = DenoGres

Welcome to DenoGres! A new comprehensive ORM for PostgreSQL and Deno. Getting Started To begin, let's download DenoGres! Execute the below in the term

Aug 29, 2022

Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Jan 3, 2023

A Serverless GraphQL Sample project using Apollo and Serverless Framework with TypeScript and Webpack.

Serverless GraphQL Boilerplate This is a base project with a structure that includes Serverless Framework, Apollo, TypeScript and Webpack. It can be d

Aug 23, 2022

AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository - https://www

Dec 17, 2022
Comments
  • Configure Renovate

    Configure Renovate

    WhiteSource Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/ci.yml (github-actions)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation
    • If semantic commits detected, use semantic commit type fix for dependencies and chore for all others
    • Ignore node_modules, bower_components, vendor and various test/tests directories
    • Autodetect whether to pin dependencies or maintain ranges
    • Rate limit PR creation to a maximum of two per hour
    • Limit to maximum 10 open PRs at any time
    • Group known monorepo packages together
    • Use curated list of recommended non-monorepo package groupings
    • Fix some problems with very old Maven commons versions
    • Ignore spring cloud 1.x releases
    • Ignore web3j 5.0.0 release
    • Ignore http4s digest-based 1.x milestones
    • Use node versioning for @types/node
    • Limit concurrent requests to reduce load on Repology servers until we can fix this properly, see issue 10133
    • Do not upgrade from Alpine stable to edge

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 1 Pull Request:

    chore(deps): update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: main
    • Upgrade actions/checkout to v3

    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 2
Releases(v0.3.2)
Owner
ʀᴀʏ
AAwwwwwwwwwwww
ʀᴀʏ
Mongo Strict is a TypeScript based smart MongoDB ORM, It makes the usage of MongoDB safer, easier and faster with a better performance...

mongo-strict mongo-strict is compatible with mongo >= 5 Mongo Strict is a TypeScript-based smart MongoDB ORM, It makes the usage of MongoDB safer, eas

Mohamed Kamel 4 Sep 22, 2022
TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Erfan Safari 20 Dec 26, 2022
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Here's a RESTful API that interacts with a PostgreSQL database written in NodeJS with Typescript, RESTify, and Sequelize ORM.

Basic description REST (Representational State Transfer) is a standard architecture for building and communicating with web services, It typically man

Olabisi Oduola 2 Jan 14, 2022
🍉 Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in Melon

?? Water Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in MelonRuntime In

Melon Runtime 22 Aug 6, 2022
Blog application api in Node.js express.js sequelize ORM and MYSQL Database

Node Express Mysql Sequelise Blog System Api Node api with express mysql sequelise Usage To get started with this api follow the steps below $ git clo

Kaddu Livingstone 6 Nov 9, 2022
Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob.

Clean-Architecture Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob. About This RE

Abdullah Adel 10 Oct 16, 2022