Nothinkdb
Functional toolkit for rethinkdb.
Currently, Compitable with rethinkdb 2.2.x
- define declarative table schema.
- handle schema validation with joi.
- handle default fields like
id
,createdAt
,updatedAt
. - ensure table, secondary index.
- ensure unique field.
- fully customizable 1-n, 1-1, n-1, n-m relations.
- define, create, remove, check, query, join relations.
- many useful query generator.
- easily implement graphql server with nothinkdb-graphql
Install
npm install -S nothinkdb
Example
;;; const userTable = tableName: 'user' id: schemaid name: Joi isPremium: Joi ; { // open rethinkdb connection const connection = await r; // sync table await userTable; await followingTable; // create user data const normalUser = userTable; const premiumUser = userTable; // insert user data into rethinkdb server await userTable; // getAll users const users = await userTable; console; // close rethinkdb connection await connection;} ;
If you want to see more examples, See the Examples
API
See the API Reference.