@minatojs/driver-mysql
Advanced tools
Comparing version 2.2.2 to 2.3.0
@@ -23,3 +23,3 @@ import type { Pool, PoolConfig } from 'mysql'; | ||
}; | ||
constructor(tables: Dict<Model>); | ||
constructor(tables?: Dict<Model>); | ||
escape(value: any, field?: Field<any>): string; | ||
@@ -26,0 +26,0 @@ } |
@@ -27,3 +27,3 @@ "use strict"; | ||
// minato/packages/mysql/src/index.ts | ||
// packages/mysql/src/index.ts | ||
var src_exports = {}; | ||
@@ -187,3 +187,3 @@ __export(src_exports, { | ||
}; | ||
this.sql = new MySQLBuilder(database.tables); | ||
this.sql = new MySQLBuilder(); | ||
} | ||
@@ -354,15 +354,10 @@ async start() { | ||
return this.queue(sql).then((data) => { | ||
return data.map((row) => this.sql.load(model, row)); | ||
return data.map((row) => builder.load(model, row)); | ||
}); | ||
} | ||
async eval(sel, expr) { | ||
const output = this.sql.parseEval(expr); | ||
let sql = this.sql.get(sel.table); | ||
const prefix = `SELECT ${output} AS value `; | ||
if (sql.startsWith("SELECT * ")) { | ||
sql = prefix + sql.slice(9); | ||
} else { | ||
sql = `${prefix}FROM (${sql}) ${sql.ref}`; | ||
} | ||
const [data] = await this.queue(sql); | ||
const builder = new MySQLBuilder(sel.tables); | ||
const output = builder.parseEval(expr); | ||
const inner = builder.get(sel.table, true); | ||
const [data] = await this.queue(`SELECT ${output} AS value FROM ${inner} ${sel.ref}`); | ||
return data.value; | ||
@@ -369,0 +364,0 @@ } |
{ | ||
"name": "@minatojs/driver-mysql", | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"description": "MySQL Driver for Minato", | ||
@@ -28,10 +28,10 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"@minatojs/core": "^2.1.2" | ||
"@minatojs/core": "^2.2.0" | ||
}, | ||
"devDependencies": { | ||
"@minatojs/tests": "^1.3.1", | ||
"@minatojs/tests": "^1.4.0", | ||
"@types/mysql": "^2.15.21" | ||
}, | ||
"dependencies": { | ||
"@minatojs/sql-utils": "^3.0.1", | ||
"@minatojs/sql-utils": "^4.0.0", | ||
"@vlasky/mysql": "^2.18.5", | ||
@@ -38,0 +38,0 @@ "cosmokit": "^1.4.0", |
Sorry, the diff of this file is not supported yet
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
48577
527
+ Added@minatojs/sql-utils@4.3.0(transitive)
- Removed@minatojs/sql-utils@3.0.1(transitive)
Updated@minatojs/sql-utils@^4.0.0