1.1.0 • Published 1 year ago

db-functional-connector v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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))

Config Object Options

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago