baja-lite 1.0.1 → 1.0.2
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/cjs/redis.d.ts +0 -0
- package/cjs/redis.js +1 -0
- package/cjs/sql.d.ts +149 -125
- package/cjs/sql.js +388 -229
- package/cjs/test-mysql.js +5 -5
- package/cjs/test-sqlite.js +7 -7
- package/es/redis.d.ts +0 -0
- package/es/redis.js +1 -0
- package/es/sql.d.ts +149 -125
- package/es/sql.js +386 -227
- package/es/test-mysql.js +6 -6
- package/es/test-sqlite.js +8 -8
- package/package.json +1 -1
package/es/test-mysql.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { SqlService,
|
|
10
|
+
import { SqlService, Boot, Field, DB, DBType, DeleteMode, SqlType, InsertMode, TemplateResult, SelectResult } from './sql';
|
|
11
11
|
class AmaFuck2 {
|
|
12
12
|
}
|
|
13
13
|
__decorate([
|
|
@@ -30,7 +30,7 @@ AmaService2 = __decorate([
|
|
|
30
30
|
})
|
|
31
31
|
], AmaService2);
|
|
32
32
|
async function go2() {
|
|
33
|
-
await
|
|
33
|
+
await Boot({
|
|
34
34
|
Mysql: {
|
|
35
35
|
host: '39.98.58.252',
|
|
36
36
|
port: 3308,
|
|
@@ -67,7 +67,7 @@ async function go2() {
|
|
|
67
67
|
const rt = await service.insert({
|
|
68
68
|
data: list,
|
|
69
69
|
conn, skipEmptyString: false,
|
|
70
|
-
mode:
|
|
70
|
+
mode: InsertMode.InsertWithTempTable
|
|
71
71
|
});
|
|
72
72
|
console.log(11, rt);
|
|
73
73
|
const rt2 = await service.update({
|
|
@@ -83,19 +83,19 @@ async function go2() {
|
|
|
83
83
|
where: [
|
|
84
84
|
{ SellerSKU2: 'SellerSKU23', SellerSKU: 'SellerSKU3' }
|
|
85
85
|
],
|
|
86
|
-
mode:
|
|
86
|
+
mode: DeleteMode.TempTable,
|
|
87
87
|
conn
|
|
88
88
|
});
|
|
89
89
|
console.log(33, rt3);
|
|
90
90
|
const rt4 = await service.template({
|
|
91
91
|
where: { SellerSKU2: 'SellerSKU22', SellerSKU: 'SellerSKU2' },
|
|
92
|
-
|
|
92
|
+
templateResult: TemplateResult.Count
|
|
93
93
|
});
|
|
94
94
|
console.log(44, rt4);
|
|
95
95
|
const rt5 = await service.select({
|
|
96
96
|
sql: `SELECT SellerSKU FROM ama_fuck2 WHERE SellerSKU LIKE CONCAT(:sku, '%');SELECT SellerSKU FROM ama_fuck2 WHERE SellerSKU LIKE CONCAT(:sku, '%');SELECT SellerSKU FROM ama_fuck2 WHERE SellerSKU LIKE CONCAT(:sku, '%')`,
|
|
97
97
|
params: { sku: 'SellerSKU4' },
|
|
98
|
-
|
|
98
|
+
selectResult: SelectResult.Many_Row_One_Column
|
|
99
99
|
});
|
|
100
100
|
console.log(55, rt5);
|
|
101
101
|
return 1;
|
package/es/test-sqlite.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import { SqlService,
|
|
10
|
+
import { SqlService, Boot, Field, SqlType, DB, DBType, SyncMode, DeleteMode, InsertMode } from './sql';
|
|
11
11
|
class AmaFuck {
|
|
12
12
|
}
|
|
13
13
|
__decorate([
|
|
@@ -30,13 +30,13 @@ AmaService = __decorate([
|
|
|
30
30
|
})
|
|
31
31
|
], AmaService);
|
|
32
32
|
async function go() {
|
|
33
|
-
await
|
|
33
|
+
await Boot({
|
|
34
34
|
Sqlite: 'd:1.db',
|
|
35
35
|
log: 'info'
|
|
36
36
|
});
|
|
37
37
|
const service = new AmaService();
|
|
38
38
|
const ret = service.transaction({
|
|
39
|
-
sync:
|
|
39
|
+
sync: SyncMode.Sync,
|
|
40
40
|
fn: conn => {
|
|
41
41
|
const list = new Array({
|
|
42
42
|
SellerSKU: '1',
|
|
@@ -58,25 +58,25 @@ async function go() {
|
|
|
58
58
|
site: undefined
|
|
59
59
|
});
|
|
60
60
|
const rt = service.insert({
|
|
61
|
-
sync:
|
|
61
|
+
sync: SyncMode.Sync,
|
|
62
62
|
data: list,
|
|
63
|
-
conn, skipEmptyString: false, mode:
|
|
63
|
+
conn, skipEmptyString: false, mode: InsertMode.InsertWithTempTable
|
|
64
64
|
});
|
|
65
65
|
console.log(rt);
|
|
66
66
|
const rt2 = service.update({
|
|
67
|
-
sync:
|
|
67
|
+
sync: SyncMode.Sync,
|
|
68
68
|
data: list,
|
|
69
69
|
conn, skipEmptyString: false
|
|
70
70
|
});
|
|
71
71
|
console.log(rt2);
|
|
72
72
|
const rt3 = service.delete({
|
|
73
|
-
sync:
|
|
73
|
+
sync: SyncMode.Sync,
|
|
74
74
|
where: [
|
|
75
75
|
{ SellerSKU2: '11', SellerSKU: '1' },
|
|
76
76
|
{ SellerSKU2: '22', SellerSKU: '2' },
|
|
77
77
|
{ SellerSKU2: '33', SellerSKU: '3' }
|
|
78
78
|
],
|
|
79
|
-
mode:
|
|
79
|
+
mode: DeleteMode.TempTable
|
|
80
80
|
});
|
|
81
81
|
console.log(rt3);
|
|
82
82
|
return 1;
|