panthera-model
v0.2.3
Published
Maps compatible object structures to MySQL query-building functionality.
Downloads
1
Readme
panthera-model
Maps compatible object structures to MySQL query-building functionality. Supports namespaces at the table, but not the database, level. Constructed queries are intended for use with mysql and mysql2's named placeholders.
Installation
npm install panthera-model
Usage
const model = require('panthera-model');
const table = {
name: 'users',
columns: {
id: //...
}
};
let users = model(table);
let selectQuery = users.usingNamespace('test').select().where('id').equals('id').limit(1);
// SELECT * FROM `test_users` WHERE `id` = :id LIMIT 1