jeefo-mysql
Advanced tools
Comparing version 0.0.53 to 0.0.54
16
index.js
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. | ||
* File Name : index.js | ||
* Created at : 2021-10-09 | ||
* Updated at : 2022-03-26 | ||
* Updated at : 2022-05-04 | ||
* Author : jeefo | ||
@@ -83,2 +83,10 @@ * Purpose : | ||
const limit_query = options => { | ||
if (is.number(options.limit)) { | ||
const offset = is.number(options.offset) ? options.offset : 0; | ||
return ` LIMIT ${offset}, ${options.limit}`; | ||
} | ||
return ''; | ||
}; | ||
class JeefoMySQLConnection { | ||
@@ -167,3 +175,3 @@ constructor(table_name, config) { | ||
const order = is.string(options.order) ? ` ORDER BY ${options.order}` : ''; | ||
const limit = is.number(options.limit) ? ` LIMIT ${options.limit}` : ''; | ||
const limit = limit_query(options); | ||
@@ -201,3 +209,3 @@ const tbl = this.table_name; | ||
const order = is.string(options.order) ? ` ORDER BY ${options.order}` : ''; | ||
const limit = is.number(options.limit) ? ` LIMIT ${options.limit}` : ''; | ||
const limit = limit_query(options); | ||
@@ -227,3 +235,3 @@ const tbl = this.table_name; | ||
const order = is.string(options.order) ? ` ORDER BY ${options.order}` : ''; | ||
const limit = is.number(options.limit) ? ` LIMIT ${options.limit}` : ''; | ||
const limit = limit_query(options); | ||
@@ -230,0 +238,0 @@ const tbl = this.table_name; |
{ | ||
"name": "jeefo-mysql", | ||
"version": "0.0.53", | ||
"version": "0.0.54", | ||
"description": "Very simple MySQL connection instances for each table. I had annoyed enough for MySQL Deadlocks.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
11998
276