liteorm
Simple ORM for SQLite with decorators and TypeScript interfaces
Last updated 6 months ago by patarapolw .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install liteorm 
SYNC missed versions from official npm registry.

liteorm

A simple wrapper for sqlite; with typings based on TypeScript decorators and reflect-metadata.

npm version

  • Async eventemitter (emittery)
    • I make sure that you can intercept query objects and raw SQL (as well as their parameters) in an async way
  • Auto-define _id as PRIMARY KEY INTEGER AUTOINCREMENT (Use _id as default name for primary key)
    • I use ROWID, instead.
  • Auto-append createdAt, updatedAt if @Table({ timestamp: true })
  • JSON, Date, Boolean, and MongoDB interop
  • Additional type StringArray, inspired by Anki schema
  • Query with JSON, and tested with https://q2search.herokuapp.com/LiteORM, using MongoDB-like languages, with some differences (for example, $regex is currently not supported, use $like, $nlike, $substr, $nsubstr instead.)
  • JSON querying is supported via JSON1 extension. I made it easy to query using dot notation, just like MongoDB.
    • So, you can use data.a
  • Multiple SQLite databases, with cloned schemas or different schemas. Strongly-typed in the IDE.

Usage

Please see /tests/suites and ankisync.js

Installation

npm i liteorm
# or yarn add liteorm

Caveats

  • Type Number by default is associated with REAL. To change it to INTEGER, use
@prop({type: 'int'}) count!: number;
  • BLOB is associated with Type ArrayBuffer.
@prop() data!: ArrayBuffer;
  • To get a strongly-typed default / onUpdate, you might have to declare typing twice.
@prop<Record<string, string>>({ default: () => ({}) }) data!: Record<string, string>;
@prop<number, EntryClass>({ default: 1, onUpdate: (ent) => parseToInt(ent) }) order!: number;
  • You might have to declare your own interface to get keys for createdAt, updatedAt, because typing is based directly on Class.

Current Tags

  • 0.9.3                                ...           latest (6 months ago)

61 Versions

  • 0.9.3                                ...           6 months ago
  • 0.9.2                                ...           7 months ago
  • 0.9.1                                ...           7 months ago
  • 0.9.0                                ...           8 months ago
  • 0.8.4                                ...           8 months ago
  • 0.8.3                                ...           8 months ago
  • 0.8.2                                ...           8 months ago
  • 0.8.1                                ...           8 months ago
  • 0.8.0                                ...           8 months ago
  • 0.7.18                                ...           8 months ago
  • 0.7.17                                ...           8 months ago
  • 0.7.16                                ...           8 months ago
  • 0.7.15                                ...           8 months ago
  • 0.7.14                                ...           8 months ago
  • 0.7.13                                ...           8 months ago
  • 0.7.12                                ...           8 months ago
  • 0.7.11                                ...           8 months ago
  • 0.7.10                                ...           8 months ago
  • 0.7.9                                ...           8 months ago
  • 0.7.8                                ...           8 months ago
  • 0.7.7                                ...           8 months ago
  • 0.7.6                                ...           8 months ago
  • 0.7.5                                ...           8 months ago
  • 0.7.4                                ...           8 months ago
  • 0.7.3                                ...           8 months ago
  • 0.7.2                                ...           8 months ago
  • 0.7.1                                ...           8 months ago
  • 0.7.0                                ...           8 months ago
  • 0.6.0                                ...           8 months ago
  • 0.5.5                                ...           8 months ago
  • 0.5.4                                ...           8 months ago
  • 0.5.3                                ...           8 months ago
  • 0.5.2                                ...           8 months ago
  • 0.5.1                                ...           8 months ago
  • 0.5.0                                ...           8 months ago
  • 0.4.8                                ...           8 months ago
  • 0.4.7                                ...           8 months ago
  • 0.4.6                                ...           8 months ago
  • 0.4.5                                ...           8 months ago
  • 0.4.4                                ...           8 months ago
  • 0.4.3                                ...           8 months ago
  • 0.4.1                                ...           8 months ago
  • 0.4.0                                ...           8 months ago
  • 0.2.4                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           a year ago
  • 0.1.10                                ...           a year ago
  • 0.1.9                                ...           a year ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)

Copyright 2014 - 2016 © taobao.org |