minato

Type Driven Database Framework

  • minato

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
minato
631.3.0a month ago4 months agoMinified + gzip package size for minato in KB

Readme

minato
Codecov downloads npm GitHub
Type Driven Database Framework.

Features

  • Compatibility. Complete driver-independent. Supports many drivers with a unified API.
  • Powerful. It can do everything that SQL can do, even though you are not using SQL drivers.
  • Well-typed. Minato is written with TypeScript, and it provides top-level typing support.
  • Extensible. Simultaneous accesss to different databases based on your needs.
  • Modern. Perform all the operations with a JavaScript API or even in the brower with low code.

Driver Supports

| Driver | Version | Notes | | ------ | ------ | ----- | | MySQL | npm | MySQL 5.7, MySQL 8.0, MariaDB 10.5 | | MongoDB | npm | | | SQLite | npm | | | LevelDB | npm | | | Memory | npm | In-memory driver support |

Basic Usage

import { Database } from 'minato'

const database = new Database()

await database.connect('mysql', {
  host: 'localhost',
  port: 3306,
  user: 'root',
  password: '',
  database: 'minato',
})

Data Definition

database.extend('user', {
  id: 'number',
  name: 'string',
  age: 'number',
  money: { type: 'number', initial: 100 },
}, {
  primary: 'id',
  autoInc: true,
})

Simple API

create

const user = await driver.create('user', {
  name: 'John',
  age: 20,
}) // { id: 1, name: 'John', age: 20, money: 100 }

get

remove

set

upsert

Selection API

Using TypeScript

Using Multiple Drivers