mysql-node-assistant

1.0.1 • Public • Published

mysql-node-assistant

Installing

npm i mysql-node-assistant

Get Column

mysqlAssitant.getColumns("table", ["know_column_name"], ["known_value"], ["column_name_value_is_wanted"]).then(res=> console.log({res}));

mysqlAssitant.getColumnsNonSafe("table", ["know_column_name"], ["known_value"], ["column_name_value_is_wanted"]).then(res=> console.log({res}));

Get Value

mysqlAssitant.getVal("table", "know_column_name", "known_value", "column_name_value_is_wanted").then(res=> console.log({res}));

Inserting

mysqlAssitant.insert("table", ["column_name_wanted_to_be_inserted"], ["value_wanted_to_be_inserted"]).then(res=> console.log({res}));

Inserting Row Then Getting PK

mysqlAssitant.insertWithPK("table", ["column_name_wanted_to_be_inserted"], ["value_wanted_to_be_inserted"]).then(res=> console.log({res}));

Sending MySQL Query

mysqlAssitant.sendQuery("select * from table where ID > ?;", [0]).then(res=> console.log({res}));

If There is a row

mysqlAssitant.thereIs("table", "known_column_name", "known_value").then(res=> console.log({res}));

mysqlAssitant.thereIsDouble("table", ["known_column_name", "other"], ["known_value", "other"]).then(res=> console.log({res}));

Updating Row

mysqlAssitant.update("table", "known_column_name", "known_value", "column_name_will_changed", "new_value").then(res=> console.log({res}));

mysqlAssitant.updateMultiple("table", ["known_column_name"], ["known_value"], ["column_name_will_changed"], ["new_value"]).then(res=> console.log({res}));

mysqlAssitant.updateNonSafe("table", "known_column_name", "known_value", "column_name_will_changed", "new_value").then(res=> console.log({res}));

Note: Check test.js for examples.

NonSafe node has not the ` symbols around value followed by where.

DBcredential.json file looks like:

{

    "host" : "127.0.0.1",
    "user" : "admin",
    "database" : "database",
    "password": "passwd"

}

Readme

Keywords

Package Sidebar

Install

npm i mysql-node-assistant

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

18.5 kB

Total Files

16

Last publish

Collaborators

  • inceabdullah