mrepo-sql 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/repo.js +3 -3
- package/package.json +2 -2
- package/src/db/repo.ts +3 -3
package/dist/db/repo.js
CHANGED
|
@@ -35,17 +35,17 @@ export class BaseRepository {
|
|
|
35
35
|
const placeholders = generateParams(endParams.length);
|
|
36
36
|
const callParams = [
|
|
37
37
|
...(placeholders ? [placeholders] : []),
|
|
38
|
-
...(out.length ? out.map(({ name }) =>
|
|
38
|
+
...(out.length ? out.map(({ name }) => `@${name}`) : [])
|
|
39
39
|
].join(',');
|
|
40
40
|
let conn;
|
|
41
41
|
try {
|
|
42
42
|
conn = await this.pool.getConnection();
|
|
43
43
|
const declareOutVars = out.length
|
|
44
|
-
? out.map(({ name, type }) => `SET
|
|
44
|
+
? out.map(({ name, type }) => `SET @${name} = CAST(NULL AS ${type ?? 'VARCHAR(255)'});`).join('\n')
|
|
45
45
|
: '';
|
|
46
46
|
const selectOuts = out.length
|
|
47
47
|
? 'SELECT ' + out
|
|
48
|
-
.map(({ name }) =>
|
|
48
|
+
.map(({ name }) => `@${name} AS ${name}`)
|
|
49
49
|
.join(',')
|
|
50
50
|
: '';
|
|
51
51
|
const query = `
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mrepo-sql",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "With mrepo-sql, the ability to create repositories with features that improve code readability and project scalability is added.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "daniel_hz",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"prepublishOnly": "npm run build"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"mariadb": "^3.4.5"
|
|
15
|
+
"mariadb": "^3.4.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^25.0.3",
|
package/src/db/repo.ts
CHANGED
|
@@ -54,7 +54,7 @@ export class BaseRepository {
|
|
|
54
54
|
|
|
55
55
|
const callParams = [
|
|
56
56
|
...(placeholders ? [placeholders] : []),
|
|
57
|
-
...(out.length ? out.map(({ name }) =>
|
|
57
|
+
...(out.length ? out.map(({ name }) => `@${name}`) : [])
|
|
58
58
|
].join(',');
|
|
59
59
|
|
|
60
60
|
let conn;
|
|
@@ -62,12 +62,12 @@ export class BaseRepository {
|
|
|
62
62
|
conn = await this.pool.getConnection();
|
|
63
63
|
|
|
64
64
|
const declareOutVars = out.length
|
|
65
|
-
? out.map(({ name, type }) => `SET
|
|
65
|
+
? out.map(({ name, type }) => `SET @${name} = CAST(NULL AS ${type ?? 'VARCHAR(255)'});`).join('\n')
|
|
66
66
|
: '';
|
|
67
67
|
|
|
68
68
|
const selectOuts = out.length
|
|
69
69
|
? 'SELECT ' + out
|
|
70
|
-
.map(({ name }) =>
|
|
70
|
+
.map(({ name }) => `@${name} AS ${name}`)
|
|
71
71
|
.join(',')
|
|
72
72
|
: '';
|
|
73
73
|
|