firenze-adapter-sqlite
SQLite adapter for firenze.js
Install it with npm: npm install --save firenze-adapter-sqlite
Contents
Install
$ npm install --save firenze-adapter-sqlite
Usage
You aren't expected to deal with the Adapter directly. Just pass the adapter to Database config when you create an instance.
var f = ;var Database = fDatabase;var SqliteAdapter = ; var db = adapter: SqliteAdapter filename: 'my_database.sqlite';
Schema
When defining a Model's schema, you need to pass option for each column's type
.
Here are the supported types from this adapter:
- increments
- integer
- bigInteger
- text
- string
- float
- decimal
- boolean
- date
- dateTime
- uuid
Example:
var Post = db;
Finders
Examples below assumes you have an instance of Collection already:
var posts = ;
first
Gives you the first matched result:
posts;
all
Gives you all matched results:
posts;
list
Gives you a list of key/value paired object of matched results:
posts;
count
Gives you the total count of matched results:
posts;
Complex conditions
equals
posts;
in list
posts;
comparisons
posts
Example comparisons that you can try:
- greater than
ModelAlias.field >
- greater than or equel to
ModelAlias.field >=
- less than
ModelAlias.field <
- less than or equal to
ModelAlias.field <=
- not equal to
ModelAlias.field !=
AND
posts;
OR
posts;
NOT
posts;
Order
For ordering results:
posts;
Group
For grouping result set:
posts;
Fields
Select only a number of fields:
posts;
Limit (pagination)
Limit number of results:
posts;
If you want to go through paginated results:
posts