@igojs/db
v6.1.1
Published
Igo ORM - Database abstraction layer for MySQL and PostgreSQL
Readme
@igojs/db
Active Record-style ORM for Igo.js. MySQL or PostgreSQL, chainable query builder, eager loading, scopes, Redis caching, SQL migrations.
Install
npm install @igojs/db
# plus the driver you need:
npm install mysql2 # for MySQL
npm install pg # for PostgreSQLQuick start
const { Model } = require('@igojs/db');
class User extends Model({
table: 'users',
columns: ['id', 'email', 'name', 'created_at', 'updated_at'],
}) {}
const alice = await User.create({ email: '[email protected]', name: 'Alice' });
const active = await User.where({ status: 'active' }).order('name ASC').list();
const page1 = await User.page(1, 20);Documentation
Full documentation: https://igocreate.github.io/igo/db/getting-started
License
ISC
