From b5734e6f40ff34eb173d3e36330a9f6c4adf16ad Mon Sep 17 00:00:00 2001 From: Arnob Almazee Date: Thu, 19 Sep 2019 00:31:57 +0600 Subject: [PATCH] documentation added --- __tests__/baseTest.js | 2 +- package-lock.json | 2 +- package.json | 2 +- readme.md | 94 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+), 3 deletions(-) diff --git a/__tests__/baseTest.js b/__tests__/baseTest.js index 7a586c4..aba68be 100644 --- a/__tests__/baseTest.js +++ b/__tests__/baseTest.js @@ -18,7 +18,7 @@ describe("Testing The import", () => { host: "localhost", user: "root", password: "mysql", - database: "exam_finalize_for_67" + database: "mysqlrTesting" }) let check_cache = cache.get('connString') expect(check_cache).not.toEqual(null) diff --git a/package-lock.json b/package-lock.json index f242071..b8c3f0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mysqlr", - "version": "1.0.7", + "version": "1.0.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f7d2bf3..99adcae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mysqlr", - "version": "1.0.10", + "version": "1.1.0", "description": "This package will easy your task with mysql.", "main": "index.js", "scripts": { diff --git a/readme.md b/readme.md index 308818d..a85190c 100644 --- a/readme.md +++ b/readme.md @@ -3,3 +3,97 @@ ## It manage all the data processing issue. Build on top of mysql. So you will get all the basic function ### Not Ready, Developing Actully :D + +### Doc v-1 + +# Basic Init + +##### Import mysqlr + +``` +const mysqlr = require('mysqlr'); +``` + +##### At the startup u have to init the mysqlr + +``` +mysqlr.init({ + host: "localhost", + user: "root", + password: "mysql", + database: "mysqlrTesting" +}) +``` + +This is for my local database. You can use your own details + +Simple right !!! + +# Oparations + +#### Supporse u had a table like this + +|T1|T2|T3|T4| +|--|--|--|--| +|At|g2|z3|t4| +|Ae|s2|a3|y4| +|A4|a2|s3|u4| +|At|22|A3|i4| +|Ay|q2|g3|o4| + +## Select Query + +Then the query like be + +Promise based so just give the query and then what you wanted to do + +``` +mysqlr.query('SELECT * FROM test1').then(response => { + consle.log(response) +}) +``` + +For async/await + +``` +let qry = await mysqlr.query('SELECT * FROM test1') +``` + +Those are bouth same. So now it your choice. + +## Insert Query + +Here mysqlr are defferent. You can insert a json type file easily. No Needed to worry. + +Suppose you have a json like + +``` +{ + test1: + { + t1: 'Hello', + t4: 'Hello' + } +} +``` + +Now you wanted insert to the db. You already checked that test1 is the table name. And next is the property and values. + +So now just use the jsonInsert. Like + +``` + const data = { + test1: + { + t1: 'Hello', + t4: 'Hello' + } + } + mysqlr.jsonInsert(data).then(response => console.log(response)) +``` + +You are done. The Data will be insert to the database. No Need to take any worried. Its worked like sequelize. But in the behide it worked using normal mysql lib. + +


+ +# More Coming. We are still Developing. Hope the will be AWESOME in the END