# ionic-sqlite-orm

> A Lightweight ORM for Ionic/Cordova application using native Sqlite plugin with Websql backfall.

Latest version **1.0.8** (published 2016-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install ionic-sqlite-orm
pnpm add ionic-sqlite-orm
yarn add ionic-sqlite-orm
bun add ionic-sqlite-orm
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2016-12-13 |
| First published | 2016-11-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | kunal.dodiya1@gmail.com |
| Maintainers | krunaldodiya |
| Keywords | ionic, sqlite, orm |

## Links

- npm: https://www.npmjs.com/package/ionic-sqlite-orm
- Repository: https://github.com/kunaldodiya/ionic-sqlite-orm
- Issues: https://github.com/kunaldodiya/ionic-sqlite-orm/issues
- npm.io page: https://npm.io/package/ionic-sqlite-orm

## Dependencies (1)

- [ionix-sqlite](https://npm.io/package/ionix-sqlite.md) *

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2016-12-13
- 1.0.7 — 2016-12-13
- 1.0.6 — 2016-12-13
- 1.0.5 — 2016-12-13
- 1.0.4 — 2016-12-13
- 1.0.3 — 2016-11-25
- 1.0.2 — 2016-11-25
- 1.0.1 — 2016-11-25
- 1.0.0 — 2016-11-24

## 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 "../services/query-builder";

---
create model first
---

```
export class PostModel extends BaseModel {
    public database: string = 'exampleDatabase.db';
    public table: string = 'posts';
    public schema: Object = {
        id: 'INTEGER(11) PRIMARY KEY',
        title: 'VARCHAR(255)',
        description: 'TEXT',
        keywords: 'TEXT',
        parent_category_id: 'INTEGER(11)',
        category_id: 'INTEGER(11)',
        cover: 'VARCHAR(255)',
        created_at: 'DATETIME',
        updated_at: 'DATETIME',
        status: 'INTEGER(1)'
    }
}
```

```
var posts = new QueryBuilder(new PostModel());

var category_id = 5;
var limit = 50;
var start = 0;

var results = posts.where("id", "=", category_id).orderBy("created_at", "DESC").limit(limit, start).get();
```

---
Query Builder methods
---

1) get()
2) delete()
3) create()
4) first()
5) where()
6) orWhere()
7) update()
8) updateOrcreate()

Sorry, npm installation not working right now, somehow. however you can Download query-builder.ts manually and put into service folder, make sure to install dependency from https://github.com/mirkonasato/ionix-sqlite.

npm install --save ionix-sqlite

---
_Source: https://npm.io/package/ionic-sqlite-orm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
