db-functional-connector
v1.1.0
Published
```javascript import DBQueries from "db-functional-connector";
Downloads
2
Readme
Example use
import DBQueries from "db-functional-connector";
export class DbConnector{
client;
constructor(config){
const preDef={
dbHost:process.env.DB_HOST,
dbName:process.env.DB_NAME,
dbUser:process.env.DB_USER,
dbPort:process.env.DB_PORT,
dbPassword:process.env.DB_PASSWORD
}
try {
this.client = new DBQueries(config, preDef)
}catch(e){
if(e) throw new Error(e)
}
}
Select(){
try {
return this.client.Select()
}catch(e){
if(e) throw new Error(e)
}
}
Delete(){
try(e){
return this.client.Delete()
}catch(e){
if(e) throw new Error(e)
}
}
Insert(){
try {
return this.client.Insert()
}catch(e){
if(e) throw new Error(e)
}
}
Update(){
try {
return this.Client.Update()
}catch(e){
if(e) throw new Error(e)
}
}
};
// exmple select statement
const config = {
table:'users',
columns:['username', 'useremail'],
where:['id', 'mobile'],
whereValue:['2', '+100 000 0000']
};
const db = new DbConnector(config);
const result = db.Select()
console.log(Promise.resolve(result))