@soinlabs/db - Database and ORM Library
Description
- Library to encapsulate ORM schema and logic in order to support multiple
database dialects based on multiple Object-Relational Mappers
How to use
Create db connection and execute raw queries
const dbOrm = new DbOrm()
dbOrm.initialize({
orm: 'sequelize',
dialect: 'postgres',
version: '12.5.0',
host: 'your_db_host',
database: 'your_db_name',
username: 'your_db_username',
password: 'your_db_password',
port: 5432,
synchronize: false,
})
const db = new DbOrm({
orm: 'sequelize',
dialect: 'postgres',
version: '12.5.0',
host: 'your_db_host',
database: 'your_db_name',
username: 'your_db_username',
password: 'your_db_password',
port: 5432,
synchronize: false,
})
testConnection = async () => {
const result = await dbOrm.test()
return result
}
async function demo() {
const result = await db.execute(`SELECT * FROM your_table`)
return result
}
Considerations according to DB Type