deno.land / x / dormlite@0.0.2

mod.test.ts1 KB
mod.ts3 KB
README.md961 B
.vscode50 B
.gitignore13 B

Deno Orm sqLite

An sqlite orm library on Deno for my personal projects. Depends on sqlite@v3.7.0.

Import

import { Database } from "https://deno.land/x/dormlite/mod.ts";

Usage

Usage is covered on the tests. You can run them with

deno test --allow-read --allow-write

Quick example:

import { Database } from "https://deno.land/x/dormlite/mod.ts";

class User extends Model {
  static tableName = "users"; // Table name

  name: string;
  email: string;

  constructor(
    name: string,
    email: string,
  ) {
    super();
    this.name = name;
    this.email = email;
  }
}

await Database.init(
  "test", // Database file name
  [User]
);

const user = new User("John Doe", "john@doe.es");

await User.create(user);

console.log(await User.all()); // [User { id: 1, name: "John Doe", email: "john@doe.es" }]

Database.db.close();
Deno.removeSync("test.db");
dormlite

Version Info

Tagged at
a year ago