Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 671 Bytes

File metadata and controls

53 lines (35 loc) · 671 Bytes

fib-orm

ORM for fibjs — a unified ORM package supporting SQLite, MySQL, and PostgreSQL.

Install

npm install fib-orm

Quick Start

const ORM = require('fib-orm');

const db = ORM.connectSync('sqlite:test.db');

const User = db.define('user', {
  name: String,
  age: Number
});

db.syncSync();

User.createSync({ name: 'Alice', age: 30 });
const users = User.findSync();
console.log(users);

db.closeSync();

Build

npm run build

Test

# SQLite
ORM_PROTOCOL=sqlite fibjs test

# MySQL
ORM_PROTOCOL=mysql fibjs test

# PostgreSQL
ORM_PROTOCOL=postgres fibjs test

License

MIT