@sqb/connect
v6.0.9
Published
Multi-dialect database connection framework written with TypeScript
Readme
About SQB
SQB is an extensible, multi-dialect SQL query builder and Database connection wrapper for NodeJS.
About @sqb/connect
@sqb/connect is the driver-agnostic connection and ORM layer built on top of
@sqb/builder. It provides:
SqbClient— manages a connection pool for a givenAdapter(the actual database driver package, e.g.@sqb/postgresor@sqb/mysql), and runs queries or callbacks against acquired connections.SqbConnection— wraps a single live connection: executes generated queries, streams or fetches cursors, and manages transactions (startTransaction/commit/rollback, with savepoint support where the adapter allows it).Repository/@Entity— a full-featured ORM on top of the client: decorate a class with@Entity,@Column,@PrimaryKey,@ForeignKeyand@Link, then usefind,findOne,create,update,deleteand their*Manycounterparts, including eager-loaded associations and embedded objects.Adapter— the interface each driver package implements, so a new database only needs a connection/cursor implementation and a dialect (SerializerExtensionfrom@sqb/builder) to plug into the rest of the stack.
import '@sqb/postgres';
import { SqbClient } from '@sqb/connect';
const client = new SqbClient({
dialect: 'postgres',
host: 'localhost',
database: 'mydb',
});
const result = await client.execute('select * from customers where id = $1', {
params: [1],
});Main goals
- Single code base for any sql based database
- Powerful and simplified query coding scheme
- Fast applications with low memory requirements
- Let applications work with large data tables efficiently
- Support latest JavaScript language standards
- Lightweight and extensible framework.
You can report bugs and discuss features on the GitHub issues page
Thanks to all of the great contributions to the project.
You may want to check detailed DOCUMENTATION
Installation
$ npm install @sqb/connect --saveNode Compatibility
- node >= 20.x
License
SQB is available under MIT license.
