Type Driven Database Framework.
Driver | Version | Notes |
---|---|---|
Memory | In-memory driver support | |
MongoDB | ||
MySQL | MySQL 5.7+, MariaDB 10.5 | |
PostgreSQL | PostgreSQL 14+ | |
SQLite |
import Database from 'minato'
import MySQLDriver from '@minatojs/driver-mysql'
const database = new Database()
await database.connect(MySQLDriver, {
host: 'localhost',
port: 3306,
user: 'root',
password: '',
database: 'minato',
})
database.extend('user', {
id: 'number',
name: 'string',
age: 'number',
money: { type: 'number', initial: 100 },
}, {
primary: 'id',
autoInc: true,
})
const user = await driver.create('user', {
name: 'John',
age: 20,
}) // { id: 1, name: 'John', age: 20, money: 100 }