darksdb-dev
Advanced tools
Comparing version 2.1.2 to 2.1.3
{ | ||
"name": "darksdb-dev", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Lightweight API to use in conjunction with MySQL", | ||
@@ -5,0 +5,0 @@ "main": "src/database/darkdb.js", |
@@ -1,2 +0,2 @@ | ||
### Latest Version: 2.1.2 | ||
### Latest Version: 2.1.3 | ||
@@ -9,4 +9,4 @@ ### [Dev Package](https://www.npmjs.com/package/darksdb-dev) | ||
- 2.1.2: | ||
- Add a check to see if a connection exists | ||
- 2.1.3: | ||
- Update TS type declarations | ||
@@ -161,2 +161,6 @@ # DarksDB | ||
- 2.1.3: | ||
- Update TS type declarations | ||
- 2.1.2: | ||
@@ -163,0 +167,0 @@ |
@@ -25,18 +25,19 @@ import { Pool, Query } from "promise-mysql"; | ||
constructor(options?: DarkDBConnOptions); | ||
connect(): Promise<>; | ||
setTable(): DarkDB; | ||
has(): boolean; | ||
set(): Query | ||
get(): Array | ||
getWhere(): Array | ||
connect(log: boolean): Promise<>; | ||
setTable(table: string): DarkDB; | ||
has(key: string, value: any): boolean; | ||
set(keys: Array, values: Array): Query | ||
get(keys: Array): Array | ||
getWhere(keys: Array, where: Array): Array | ||
getAll(): Array | ||
getAllWhere(): Array | ||
delete(): Query | ||
getAllWhere(where: Array): Array | ||
delete(where: Array): Query | ||
deleteAll(): Query | ||
update(): Query | ||
updateWhere(): Query | ||
runStatement(): Query | Array | ||
#keys(): String | ||
#updatekeys(): String | ||
#query(): Query | ||
update(keys: Array, values: Array): Query | ||
updateWhere(keys: Array, values: Array, where: Array): Query | ||
runStatement(statement: string): Query | Array | ||
#checkPool(): boolean | ||
#keys(keys: Array, statement: string, values: Array, insert: boolean, update: boolean, useQuotations: boolean): string | ||
#updatekeys(keys: Array, values: Array, statement: string): string | ||
#query(statement: string): Query | ||
} |
@@ -51,3 +51,3 @@ const mysql = require("promise-mysql"); | ||
async checkPool() { | ||
async #checkPool() { | ||
return new Promise(async (resolve, reject) => { | ||
@@ -63,3 +63,3 @@ if (!this.pool) { | ||
async setTable(table) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
const options = { ...this.options }; | ||
@@ -72,3 +72,3 @@ options.table = table; | ||
return new Promise(async (resolve, reject) => { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
let statement = `SELECT COUNT(*) FROM ${this.table} WHERE ${key} = '${value}'`; | ||
@@ -88,3 +88,3 @@ | ||
async set(keys, values) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise (async (resolve, reject) => { | ||
@@ -126,3 +126,3 @@ if (keys.length !== values.length) { | ||
async get(keys) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise(async (resolve, reject) => { | ||
@@ -143,3 +143,3 @@ let stmt = await this.#keys(keys, `SELECT `) | ||
async getWhere(keys, where) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
if (!where) { | ||
@@ -168,3 +168,3 @@ console.log('No `where` specified, using get() instead.') | ||
async getAll() { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise(async (resolve, reject) => { | ||
@@ -184,3 +184,3 @@ let statement = `SELECT * FROM ${this.table}`; | ||
async getAllWhere(where) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
if (!where) { | ||
@@ -206,3 +206,3 @@ console.log('No `where` specified, using getAll() instead.') | ||
async delete(where) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
if (!where) { | ||
@@ -227,3 +227,3 @@ console.log('No `where` for delete()') | ||
async deleteAll() { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise(async (resolve, reject) => { | ||
@@ -242,3 +242,3 @@ let statement = `DELETE FROM ${this.table}`; | ||
async update(keys, values) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise (async (resolve, reject) => { | ||
@@ -265,3 +265,3 @@ if (keys.length != values.length) { | ||
async updateWhere(keys, values, where) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise (async (resolve, reject) => { | ||
@@ -293,3 +293,3 @@ if (keys.length != values.length) { | ||
async runStatement(statement) { | ||
await this.checkPool(); | ||
await this.#checkPool(); | ||
return new Promise((resolve, reject) => { | ||
@@ -296,0 +296,0 @@ try { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17784
366
191