Merge branch 'main' into release

This commit is contained in:
Sam 2025-03-27 21:20:24 +01:00
commit 2a0acb643d
8 changed files with 41 additions and 14 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules/
**/node_modules/
.env

View File

@ -263,7 +263,7 @@ class Instance {
* Drops a whole database
* - Requires admin privileges
* @param {String} database - Name of the database to drop
* @returns {Any}
* @returns {OkPacket}
*/
async dropDatabase (database){
if (!database) throw new Error(`Can't drop database: No database given`);
@ -274,7 +274,7 @@ class Instance {
/**
* Drops a whole table
* @param {String} table - Name of the table to drop
* @returns {Any}
* @returns {OkPacket}
*/
async dropTable(table){
if (!table) throw new Error("Can't drop table: No table set");
@ -287,7 +287,7 @@ class Instance {
* Creates a new database
* - Requires admin privileges
* @param {String} name - Name of the database to create
* @returns {Any}
* @returns {OkPacket}
*/
async createDatabase(name){
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
* @param {String} table - Table name
* @returns {Any}
* @returns {Number}
*/
async total(table){
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
*/
/**
* @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();
module.exports = {awSQL: awSQLInstance, Structure};

View File

@ -57,7 +57,7 @@ class Delete {
/**
* Executes the prepared querry
* @returns {Any}
* @returns {import("../index").OkPacket}
*/
async execute(){
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);

View File

@ -42,7 +42,7 @@ class Insert {
/**
* Executes the prepared querry
* @returns {Any}
* @returns {import("../index").OkPacket}
*/
async execute(){
if (!this.#data) throw new Error("Insert: tried to insert without data");

View File

@ -44,7 +44,7 @@ class AlterTable {
/**
* Executes the prepared querry
* @returns {Any}
* @returns {import("../index").CheckResult}
*/
async execute(){
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
* @returns {Any}
* @returns {import("../index").OkPacket}
*/
async execute(){
if (!this.#database) throw new Error(`Can't create table ${this.#name}: Database not selected`);

View File

@ -69,7 +69,7 @@ class Update{
/**
* Executes the prepared querry
* @returns {Any}
* @returns {import("../index").OkPacket}
*/
async execute(){
if (!this.#instance.isConnected()) throw new Error(`Can't execute query: Instance has no connection`);

20
package-lock.json generated
View File

@ -1,16 +1,18 @@
{
"name": "awsql_refined",
"name": "awsql",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "awsql_refined",
"name": "awsql",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"dotenv": "^16.4.7",
"mysql": "^2.18.1"
}
},
"devDependencies": {}
},
"node_modules/bignumber.js": {
"version": "9.0.0",
@ -27,6 +29,18 @@
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
"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": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",

View File

@ -8,8 +8,8 @@
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.4.7",
"mysql": "^2.18.1"
},
"devDependencies": {},
"description": ""
}