vantor-orm
v0.1.6
Published
VANTOR ORM - High-performance database client
Maintainers
Readme
@vantor/client
VANTOR ORM Client for TypeScript/JavaScript
Instalação
npm install @vantor/clientUso Rápido
SQLite
import { VantorClient, SqliteDriver } from '@vantor/client';
// Criar driver
const driver = new SqliteDriver('./database.db');
// Criar cliente
const client = new VantorClient({ driver });
// Operações
const users = await client.user.findMany();PostgreSQL
import { VantorClient, PostgresDriver } from '@vantor/client';
const driver = new PostgresDriver({
host: 'localhost',
port: 5432,
database: 'mydb',
user: 'postgres',
password: 'password',
});
const client = new VantorClient({ driver });##驱动 (Drivers)
SQLite
import { SqliteDriver } from '@vantor/client/sqlite';
const driver = new SqliteDriver('./mydb.sqlite');
driver.runMigrations(`
CREATE TABLE User (
id INTEGER PRIMARY KEY,
name TEXT
);
`);PostgreSQL
import { PostgresDriver } from '@vantor/client/postgres';
const driver = new PostgresDriver({
host: 'localhost',
database: 'mydb',
user: 'postgres',
password: 'password',
});API
VantorClient
connect()- Conectar ao bancodisconnect()- Desconectarexecute(sql, params)- Executar SQLquery(sql, params)- Consultar dadostransaction(fn)- Executar em transação
License
MIT
