ionic-sqlite-orm
v1.0.8
Published
A Lightweight ORM for Ionic/Cordova application using native Sqlite plugin with Websql backfall.
Downloads
16
Readme
ionic-sqlite-orm
This a a light-weight ORM for ionic 2 using native SQLITE plugin for cordova and WebSQL for browser support. This package is using SqlDatabase (https://github.com/mirkonasato/ionix-sqlite) as dependency. Thanks to mirkonasato for support.
Installation
npm i ionic-sqlite-orm
How to use
You need to first create a model which will extends to QueryBuilder. for example :- post.model.ts
import {BaseModel} from 'query-builder';
export class PostModel extends BaseModel {
public database: string = 'test.db';
public table: string = 'posts';
public schema: Object = {
id: 'INTEGER(11) PRIMARY KEY',
title: 'VARCHAR(255)',
description: 'TEXT',
parent_category_id: 'INTEGER(11)',
category_id: 'INTEGER(11)',
cover: 'VARCHAR(255)',
created_at: 'DATETIME',
updated_at: 'DATETIME',
status: 'INTEGER(1)'
}
}