Merge branch 'main' into release
This commit is contained in:
commit
2a0acb643d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
**/node_modules/
|
**/node_modules/
|
||||||
|
.env
|
||||||
20
index.js
20
index.js
@ -263,7 +263,7 @@ class Instance {
|
|||||||
* Drops a whole database
|
* Drops a whole database
|
||||||
* - Requires admin privileges
|
* - Requires admin privileges
|
||||||
* @param {String} database - Name of the database to drop
|
* @param {String} database - Name of the database to drop
|
||||||
* @returns {Any}
|
* @returns {OkPacket}
|
||||||
*/
|
*/
|
||||||
async dropDatabase (database){
|
async dropDatabase (database){
|
||||||
if (!database) throw new Error(`Can't drop database: No database given`);
|
if (!database) throw new Error(`Can't drop database: No database given`);
|
||||||
@ -274,7 +274,7 @@ class Instance {
|
|||||||
/**
|
/**
|
||||||
* Drops a whole table
|
* Drops a whole table
|
||||||
* @param {String} table - Name of the table to drop
|
* @param {String} table - Name of the table to drop
|
||||||
* @returns {Any}
|
* @returns {OkPacket}
|
||||||
*/
|
*/
|
||||||
async dropTable(table){
|
async dropTable(table){
|
||||||
if (!table) throw new Error("Can't drop table: No table set");
|
if (!table) throw new Error("Can't drop table: No table set");
|
||||||
@ -287,7 +287,7 @@ class Instance {
|
|||||||
* Creates a new database
|
* Creates a new database
|
||||||
* - Requires admin privileges
|
* - Requires admin privileges
|
||||||
* @param {String} name - Name of the database to create
|
* @param {String} name - Name of the database to create
|
||||||
* @returns {Any}
|
* @returns {OkPacket}
|
||||||
*/
|
*/
|
||||||
async createDatabase(name){
|
async createDatabase(name){
|
||||||
if (!name) throw new Error(`Can't create database: No name given`);
|
if (!name) throw new Error(`Can't create database: No name given`);
|
||||||
@ -385,7 +385,7 @@ class Instance {
|
|||||||
/**
|
/**
|
||||||
* Returns total amount of rows of a table
|
* Returns total amount of rows of a table
|
||||||
* @param {String} table - Table name
|
* @param {String} table - Table name
|
||||||
* @returns {Any}
|
* @returns {Number}
|
||||||
*/
|
*/
|
||||||
async total(table){
|
async total(table){
|
||||||
if (!table) throw new Error("Can't get structure: table not given");
|
if (!table) throw new Error("Can't get structure: table not given");
|
||||||
@ -410,6 +410,18 @@ class Instance {
|
|||||||
* @property {Array<String>} passed - String representation of passed checks
|
* @property {Array<String>} passed - String representation of passed checks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} OkPacket
|
||||||
|
* @property {Number} fieldCount - Defaults to 0 on non-select queries
|
||||||
|
* @property {Number} affectedRows - The number of rows affected by the query
|
||||||
|
* @property {Number} insertId - The ID of the last inserted row if the table has an auto-increment column; otherwise always 0
|
||||||
|
* @property {Number} serverStatus - A status flag representing the current state of the mysql server
|
||||||
|
* @property {Number} warningCount - The number of warnings generated during query execution.
|
||||||
|
* @property {String} message - An optional message providin additional information about the query result (normally empty)
|
||||||
|
* @property {Boolean} protocol41 - Whether mysql protocol 4.1 or later is used
|
||||||
|
* @property {Number} changedRows - The number of rows actually changed by the query
|
||||||
|
*/
|
||||||
|
|
||||||
const awSQLInstance = new awSQL();
|
const awSQLInstance = new awSQL();
|
||||||
module.exports = {awSQL: awSQLInstance, Structure};
|
module.exports = {awSQL: awSQLInstance, Structure};
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class Delete {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the prepared querry
|
* Executes the prepared querry
|
||||||
* @returns {Any}
|
* @returns {import("../index").OkPacket}
|
||||||
*/
|
*/
|
||||||
async execute(){
|
async execute(){
|
||||||
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);
|
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);
|
||||||
|
|||||||
@ -42,7 +42,7 @@ class Insert {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the prepared querry
|
* Executes the prepared querry
|
||||||
* @returns {Any}
|
* @returns {import("../index").OkPacket}
|
||||||
*/
|
*/
|
||||||
async execute(){
|
async execute(){
|
||||||
if (!this.#data) throw new Error("Insert: tried to insert without data");
|
if (!this.#data) throw new Error("Insert: tried to insert without data");
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class AlterTable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the prepared querry
|
* Executes the prepared querry
|
||||||
* @returns {Any}
|
* @returns {import("../index").CheckResult}
|
||||||
*/
|
*/
|
||||||
async execute(){
|
async execute(){
|
||||||
if (!this.#database) throw new Error(`Can't alter table ${this.#name}: Database not selected`);
|
if (!this.#database) throw new Error(`Can't alter table ${this.#name}: Database not selected`);
|
||||||
@ -170,7 +170,7 @@ class CreateTable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the prepared querry
|
* Executes the prepared querry
|
||||||
* @returns {Any}
|
* @returns {import("../index").OkPacket}
|
||||||
*/
|
*/
|
||||||
async execute(){
|
async execute(){
|
||||||
if (!this.#database) throw new Error(`Can't create table ${this.#name}: Database not selected`);
|
if (!this.#database) throw new Error(`Can't create table ${this.#name}: Database not selected`);
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class Update{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the prepared querry
|
* Executes the prepared querry
|
||||||
* @returns {Any}
|
* @returns {import("../index").OkPacket}
|
||||||
*/
|
*/
|
||||||
async execute(){
|
async execute(){
|
||||||
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);
|
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);
|
||||||
|
|||||||
20
package-lock.json
generated
20
package-lock.json
generated
@ -1,16 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "awsql_refined",
|
"name": "awsql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "awsql_refined",
|
"name": "awsql",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
"mysql": "^2.18.1"
|
"mysql": "^2.18.1"
|
||||||
}
|
},
|
||||||
|
"devDependencies": {}
|
||||||
},
|
},
|
||||||
"node_modules/bignumber.js": {
|
"node_modules/bignumber.js": {
|
||||||
"version": "9.0.0",
|
"version": "9.0.0",
|
||||||
@ -27,6 +29,18 @@
|
|||||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/dotenv": {
|
||||||
|
"version": "16.4.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
|
||||||
|
"integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://dotenvx.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/inherits": {
|
"node_modules/inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"dotenv": "^16.4.7",
|
||||||
"mysql": "^2.18.1"
|
"mysql": "^2.18.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
|
||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user