1.0.8 • Published 6 years ago
thin-rdb v1.0.8
Thin RDB
The most proper RDBMS wrapper for dynamic languages like Javascript. Embraces the beauty of both worlds
Install
npm i --save thin-rdb
const {createThinRdb, pt} = require("thin-rdb");
const rdb = createThinRdb(dbSchema);
Usage
await rdb.select(con, "top 1 employee_location join employee, location as l", {location_id: "loc:1"})
Which output:
[
{
"employee_id": "emp:john",
"location_id": "loc:1",
"employee": {
"id": "emp:john",
"name": "John Doe",
"company_id": "com:1"
},
"l": {
"id": "loc:1",
"company_id": "com:1"
}
}
]
This support nested joins too, like:
employee_location join (employee join person), location as l
Or custom join by field with by
:
employee_location join employee by employee_id as emp
And with field faces, so we can show/hide fields for certain queries, for example:
rdb.select(con, "person!secret")
will contain “password” field, while rdb.select(con, "person")
will not,
with password field declared as: password: "!secret",
Select single field: rdb.select(con, "person.id", {name: "A"})