1.1.0 • Published 2 years ago

db-functional-connector v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years 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

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago