@k3000/store 1.4.4 → 1.5.1
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/README.md +1 -1
- package/architect.mjs +67 -4
- package/generator.mjs +8 -5
- package/package.json +1 -1
- package/test/1/index +0 -0
- package/test/1/index.mjs +27 -15
- package/test/1/type.ts +9 -6
- package/test/2/data +0 -0
- package/test/2/index +0 -0
- package/test/2/index.mjs +27 -15
- package/test/2/type.ts +10 -6
- package/test/3/data +0 -0
- package/test/3/index +0 -0
- package/test/3/index.mjs +27 -15
- package/test/3/type.ts +10 -6
- package/test/4/data +0 -0
- package/test/4/index +0 -0
- package/test/4/index.mjs +27 -15
- package/test/4/type.ts +10 -6
- package/test/5/data +0 -0
- package/test/5/index +0 -0
- package/test/5/index.mjs +27 -15
- package/test/5/type.ts +10 -6
- package/test/6/data +0 -0
- package/test/6/index +0 -0
- package/test/6/index.mjs +23 -13
- package/test/6/type.ts +8 -5
- package/test/7/data +0 -0
- package/test/7/index +0 -0
- package/test/7/index.mjs +27 -15
- package/test/7/type.ts +9 -6
- package/test/8/data +0 -0
- package/test/8/index +0 -0
- package/test/8/index.mjs +27 -15
- package/test/8/type.ts +9 -6
- package/test.mjs +137 -132
package/test/4/type.ts
CHANGED
|
@@ -23,11 +23,12 @@ interface Admin {
|
|
|
23
23
|
time: Number | Date
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
interface AdminSet extends Array<Admin> {
|
|
27
28
|
|
|
28
|
-
indexById(id: Number): Array<Admin>
|
|
29
|
-
indexByUid(uid: String): Array<Admin>
|
|
30
|
-
indexByValid(valid: Number): Array<Admin>
|
|
29
|
+
indexById(id: Number, id_2?: Number): Array<Admin>
|
|
30
|
+
indexByUid(uid: String, uid_2?: String): Array<Admin>
|
|
31
|
+
indexByValid(valid: Number, valid_2?: Number): Array<Admin>
|
|
31
32
|
indexByTime({after, before}): Array<Admin>
|
|
32
33
|
/**
|
|
33
34
|
* 重写push方法
|
|
@@ -79,10 +80,11 @@ interface Log {
|
|
|
79
80
|
content: String
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
interface LogSet extends Array<Log> {
|
|
83
85
|
|
|
84
|
-
indexById(id: Number): Array<Log>
|
|
85
|
-
indexByUid(uid: String): Array<Log>
|
|
86
|
+
indexById(id: Number, id_2?: Number): Array<Log>
|
|
87
|
+
indexByUid(uid: String, uid_2?: String): Array<Log>
|
|
86
88
|
indexByTime({after, before}): Array<Log>
|
|
87
89
|
/**
|
|
88
90
|
* 重写push方法
|
|
@@ -154,9 +156,10 @@ interface Test {
|
|
|
154
156
|
text: String
|
|
155
157
|
}
|
|
156
158
|
|
|
159
|
+
// @ts-ignore
|
|
157
160
|
interface TestSet extends Array<Test> {
|
|
158
161
|
|
|
159
|
-
indexById(id: Number): Array<Test>
|
|
162
|
+
indexById(id: Number, id_2?: Number): Array<Test>
|
|
160
163
|
/**
|
|
161
164
|
* 重写push方法
|
|
162
165
|
*/
|
|
@@ -212,6 +215,7 @@ interface Test3 {
|
|
|
212
215
|
test2: String
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
// @ts-ignore
|
|
215
219
|
interface Test3Set extends Array<Test3> {
|
|
216
220
|
|
|
217
221
|
/**
|
package/test/5/data
CHANGED
|
Binary file
|
package/test/5/index
CHANGED
|
Binary file
|
package/test/5/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {Entities, Entity, Storage, b2d, d2b, b2s, position, uInt32BEToBuffer, int32BEToBuffer,
|
|
3
|
-
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store} from '../../architect.mjs'
|
|
3
|
+
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store, MaxTime} from '../../architect.mjs'
|
|
4
4
|
import {struct} from '../../generator.mjs'
|
|
5
5
|
|
|
6
6
|
const storage = new Storage(import.meta.url)
|
|
@@ -334,24 +334,30 @@ class AdminSet extends Entities {
|
|
|
334
334
|
throw new TypeError('stringToBuffer is not a function')
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
indexById(id) {
|
|
337
|
+
indexById(id, id_2) {
|
|
338
338
|
|
|
339
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
339
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
340
|
+
|
|
341
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
340
342
|
}
|
|
341
343
|
|
|
342
|
-
indexByUid(uid) {
|
|
344
|
+
indexByUid(uid, uid_2) {
|
|
345
|
+
|
|
346
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
343
347
|
|
|
344
|
-
return super.
|
|
348
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
indexByValid(valid) {
|
|
351
|
+
indexByValid(valid, valid_2) {
|
|
352
|
+
|
|
353
|
+
if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
|
|
348
354
|
|
|
349
|
-
return super.
|
|
355
|
+
return super.findByRange($valid, super.intToBuffer(valid, $valid), super.intToBuffer(valid_2, $valid))
|
|
350
356
|
}
|
|
351
357
|
|
|
352
358
|
indexByTime({after, before} = {}) {
|
|
353
359
|
|
|
354
|
-
return super.
|
|
360
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
355
361
|
}
|
|
356
362
|
}
|
|
357
363
|
|
|
@@ -390,19 +396,23 @@ class LogSet extends Entities {
|
|
|
390
396
|
throw new TypeError('stringToBuffer is not a function')
|
|
391
397
|
}
|
|
392
398
|
|
|
393
|
-
indexById(id) {
|
|
399
|
+
indexById(id, id_2) {
|
|
394
400
|
|
|
395
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
401
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
402
|
+
|
|
403
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
396
404
|
}
|
|
397
405
|
|
|
398
|
-
indexByUid(uid) {
|
|
406
|
+
indexByUid(uid, uid_2) {
|
|
407
|
+
|
|
408
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
399
409
|
|
|
400
|
-
return super.
|
|
410
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
401
411
|
}
|
|
402
412
|
|
|
403
413
|
indexByTime({after, before} = {}) {
|
|
404
414
|
|
|
405
|
-
return super.
|
|
415
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
406
416
|
}
|
|
407
417
|
}
|
|
408
418
|
|
|
@@ -441,9 +451,11 @@ class TestSet extends Entities {
|
|
|
441
451
|
throw new TypeError('stringToBuffer is not a function')
|
|
442
452
|
}
|
|
443
453
|
|
|
444
|
-
indexById(id) {
|
|
454
|
+
indexById(id, id_2) {
|
|
455
|
+
|
|
456
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
445
457
|
|
|
446
|
-
return super.
|
|
458
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
447
459
|
}
|
|
448
460
|
}
|
|
449
461
|
|
package/test/5/type.ts
CHANGED
|
@@ -23,11 +23,12 @@ interface Admin {
|
|
|
23
23
|
time: Number | Date
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
interface AdminSet extends Array<Admin> {
|
|
27
28
|
|
|
28
|
-
indexById(id: Number): Array<Admin>
|
|
29
|
-
indexByUid(uid: String): Array<Admin>
|
|
30
|
-
indexByValid(valid: Number): Array<Admin>
|
|
29
|
+
indexById(id: Number, id_2?: Number): Array<Admin>
|
|
30
|
+
indexByUid(uid: String, uid_2?: String): Array<Admin>
|
|
31
|
+
indexByValid(valid: Number, valid_2?: Number): Array<Admin>
|
|
31
32
|
indexByTime({after, before}): Array<Admin>
|
|
32
33
|
/**
|
|
33
34
|
* 重写push方法
|
|
@@ -79,10 +80,11 @@ interface Log {
|
|
|
79
80
|
content: String
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
interface LogSet extends Array<Log> {
|
|
83
85
|
|
|
84
|
-
indexById(id: Number): Array<Log>
|
|
85
|
-
indexByUid(uid: String): Array<Log>
|
|
86
|
+
indexById(id: Number, id_2?: Number): Array<Log>
|
|
87
|
+
indexByUid(uid: String, uid_2?: String): Array<Log>
|
|
86
88
|
indexByTime({after, before}): Array<Log>
|
|
87
89
|
/**
|
|
88
90
|
* 重写push方法
|
|
@@ -154,9 +156,10 @@ interface Test {
|
|
|
154
156
|
text: String
|
|
155
157
|
}
|
|
156
158
|
|
|
159
|
+
// @ts-ignore
|
|
157
160
|
interface TestSet extends Array<Test> {
|
|
158
161
|
|
|
159
|
-
indexById(id: Number): Array<Test>
|
|
162
|
+
indexById(id: Number, id_2?: Number): Array<Test>
|
|
160
163
|
/**
|
|
161
164
|
* 重写push方法
|
|
162
165
|
*/
|
|
@@ -212,6 +215,7 @@ interface Test3 {
|
|
|
212
215
|
test2: String
|
|
213
216
|
}
|
|
214
217
|
|
|
218
|
+
// @ts-ignore
|
|
215
219
|
interface Test3Set extends Array<Test3> {
|
|
216
220
|
|
|
217
221
|
/**
|
package/test/6/data
CHANGED
|
Binary file
|
package/test/6/index
CHANGED
|
Binary file
|
package/test/6/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {Entities, Entity, Storage, b2d, d2b, b2s, position, uInt32BEToBuffer, int32BEToBuffer,
|
|
3
|
-
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store} from '../../architect.mjs'
|
|
3
|
+
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store, MaxTime} from '../../architect.mjs'
|
|
4
4
|
import {struct} from '../../generator.mjs'
|
|
5
5
|
|
|
6
6
|
const storage = new Storage(import.meta.url)
|
|
@@ -235,24 +235,30 @@ class AdminSet extends Entities {
|
|
|
235
235
|
throw new TypeError('stringToBuffer is not a function')
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
indexById(id) {
|
|
238
|
+
indexById(id, id_2) {
|
|
239
239
|
|
|
240
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
240
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
241
|
+
|
|
242
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
indexByUid(uid) {
|
|
245
|
+
indexByUid(uid, uid_2) {
|
|
246
|
+
|
|
247
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
244
248
|
|
|
245
|
-
return super.
|
|
249
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
246
250
|
}
|
|
247
251
|
|
|
248
|
-
indexByValid(valid) {
|
|
252
|
+
indexByValid(valid, valid_2) {
|
|
253
|
+
|
|
254
|
+
if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
|
|
249
255
|
|
|
250
|
-
return super.
|
|
256
|
+
return super.findByRange($valid, super.intToBuffer(valid, $valid), super.intToBuffer(valid_2, $valid))
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
indexByTime({after, before} = {}) {
|
|
254
260
|
|
|
255
|
-
return super.
|
|
261
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
|
|
@@ -291,19 +297,23 @@ class LogSet extends Entities {
|
|
|
291
297
|
throw new TypeError('stringToBuffer is not a function')
|
|
292
298
|
}
|
|
293
299
|
|
|
294
|
-
indexById(id) {
|
|
300
|
+
indexById(id, id_2) {
|
|
295
301
|
|
|
296
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
302
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
303
|
+
|
|
304
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
297
305
|
}
|
|
298
306
|
|
|
299
|
-
indexByUid(uid) {
|
|
307
|
+
indexByUid(uid, uid_2) {
|
|
308
|
+
|
|
309
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
300
310
|
|
|
301
|
-
return super.
|
|
311
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
302
312
|
}
|
|
303
313
|
|
|
304
314
|
indexByTime({after, before} = {}) {
|
|
305
315
|
|
|
306
|
-
return super.
|
|
316
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
307
317
|
}
|
|
308
318
|
}
|
|
309
319
|
|
package/test/6/type.ts
CHANGED
|
@@ -23,11 +23,12 @@ interface Admin {
|
|
|
23
23
|
time: Number | Date
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
interface AdminSet extends Array<Admin> {
|
|
27
28
|
|
|
28
|
-
indexById(id: Number): Array<Admin>
|
|
29
|
-
indexByUid(uid: String): Array<Admin>
|
|
30
|
-
indexByValid(valid: Number): Array<Admin>
|
|
29
|
+
indexById(id: Number, id_2?: Number): Array<Admin>
|
|
30
|
+
indexByUid(uid: String, uid_2?: String): Array<Admin>
|
|
31
|
+
indexByValid(valid: Number, valid_2?: Number): Array<Admin>
|
|
31
32
|
indexByTime({after, before}): Array<Admin>
|
|
32
33
|
/**
|
|
33
34
|
* 重写push方法
|
|
@@ -79,10 +80,11 @@ interface Log {
|
|
|
79
80
|
content: String
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
interface LogSet extends Array<Log> {
|
|
83
85
|
|
|
84
|
-
indexById(id: Number): Array<Log>
|
|
85
|
-
indexByUid(uid: String): Array<Log>
|
|
86
|
+
indexById(id: Number, id_2?: Number): Array<Log>
|
|
87
|
+
indexByUid(uid: String, uid_2?: String): Array<Log>
|
|
86
88
|
indexByTime({after, before}): Array<Log>
|
|
87
89
|
/**
|
|
88
90
|
* 重写push方法
|
|
@@ -135,6 +137,7 @@ interface Test3 {
|
|
|
135
137
|
test2: String
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
// @ts-ignore
|
|
138
141
|
interface Test3Set extends Array<Test3> {
|
|
139
142
|
|
|
140
143
|
/**
|
package/test/7/data
CHANGED
|
Binary file
|
package/test/7/index
CHANGED
|
Binary file
|
package/test/7/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {Entities, Entity, Storage, b2d, d2b, b2s, position, uInt32BEToBuffer, int32BEToBuffer,
|
|
3
|
-
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store} from '../../architect.mjs'
|
|
3
|
+
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store, MaxTime} from '../../architect.mjs'
|
|
4
4
|
import {struct} from '../../generator.mjs'
|
|
5
5
|
|
|
6
6
|
const storage = new Storage(import.meta.url)
|
|
@@ -235,24 +235,30 @@ class AdminSet extends Entities {
|
|
|
235
235
|
throw new TypeError('stringToBuffer is not a function')
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
indexById(id) {
|
|
238
|
+
indexById(id, id_2) {
|
|
239
239
|
|
|
240
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
240
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
241
|
+
|
|
242
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
indexByUid(uid) {
|
|
245
|
+
indexByUid(uid, uid_2) {
|
|
246
|
+
|
|
247
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
244
248
|
|
|
245
|
-
return super.
|
|
249
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
246
250
|
}
|
|
247
251
|
|
|
248
|
-
indexByValid(valid) {
|
|
252
|
+
indexByValid(valid, valid_2) {
|
|
253
|
+
|
|
254
|
+
if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
|
|
249
255
|
|
|
250
|
-
return super.
|
|
256
|
+
return super.findByRange($valid, super.intToBuffer(valid, $valid), super.intToBuffer(valid_2, $valid))
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
indexByTime({after, before} = {}) {
|
|
254
260
|
|
|
255
|
-
return super.
|
|
261
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
|
|
@@ -291,24 +297,30 @@ class LogSet extends Entities {
|
|
|
291
297
|
throw new TypeError('stringToBuffer is not a function')
|
|
292
298
|
}
|
|
293
299
|
|
|
294
|
-
indexById(id) {
|
|
300
|
+
indexById(id, id_2) {
|
|
295
301
|
|
|
296
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
302
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
303
|
+
|
|
304
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
297
305
|
}
|
|
298
306
|
|
|
299
|
-
indexByUid(uid) {
|
|
307
|
+
indexByUid(uid, uid_2) {
|
|
308
|
+
|
|
309
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
300
310
|
|
|
301
|
-
return super.
|
|
311
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
302
312
|
}
|
|
303
313
|
|
|
304
|
-
indexByType(type) {
|
|
314
|
+
indexByType(type, type_2) {
|
|
315
|
+
|
|
316
|
+
if (type_2 === undefined) return super.findByValue($type, super.uintToBuffer(type, $type))
|
|
305
317
|
|
|
306
|
-
return super.
|
|
318
|
+
return super.findByRange($type, super.intToBuffer(type, $type), super.intToBuffer(type_2, $type))
|
|
307
319
|
}
|
|
308
320
|
|
|
309
321
|
indexByTime({after, before} = {}) {
|
|
310
322
|
|
|
311
|
-
return super.
|
|
323
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
312
324
|
}
|
|
313
325
|
}
|
|
314
326
|
|
package/test/7/type.ts
CHANGED
|
@@ -23,11 +23,12 @@ interface Admin {
|
|
|
23
23
|
time: Number | Date
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
interface AdminSet extends Array<Admin> {
|
|
27
28
|
|
|
28
|
-
indexById(id: Number): Array<Admin>
|
|
29
|
-
indexByUid(uid: String): Array<Admin>
|
|
30
|
-
indexByValid(valid: Number): Array<Admin>
|
|
29
|
+
indexById(id: Number, id_2?: Number): Array<Admin>
|
|
30
|
+
indexByUid(uid: String, uid_2?: String): Array<Admin>
|
|
31
|
+
indexByValid(valid: Number, valid_2?: Number): Array<Admin>
|
|
31
32
|
indexByTime({after, before}): Array<Admin>
|
|
32
33
|
/**
|
|
33
34
|
* 重写push方法
|
|
@@ -79,11 +80,12 @@ interface Log {
|
|
|
79
80
|
content: String
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
interface LogSet extends Array<Log> {
|
|
83
85
|
|
|
84
|
-
indexById(id: Number): Array<Log>
|
|
85
|
-
indexByUid(uid: String): Array<Log>
|
|
86
|
-
indexByType(type: Number): Array<Log>
|
|
86
|
+
indexById(id: Number, id_2?: Number): Array<Log>
|
|
87
|
+
indexByUid(uid: String, uid_2?: String): Array<Log>
|
|
88
|
+
indexByType(type: Number, type_2?: Number): Array<Log>
|
|
87
89
|
indexByTime({after, before}): Array<Log>
|
|
88
90
|
/**
|
|
89
91
|
* 重写push方法
|
|
@@ -136,6 +138,7 @@ interface Test3 {
|
|
|
136
138
|
test2: String
|
|
137
139
|
}
|
|
138
140
|
|
|
141
|
+
// @ts-ignore
|
|
139
142
|
interface Test3Set extends Array<Test3> {
|
|
140
143
|
|
|
141
144
|
/**
|
package/test/8/data
CHANGED
|
Binary file
|
package/test/8/index
CHANGED
|
Binary file
|
package/test/8/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {Entities, Entity, Storage, b2d, d2b, b2s, position, uInt32BEToBuffer, int32BEToBuffer,
|
|
3
|
-
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store} from '../../architect.mjs'
|
|
3
|
+
doubleBEToBuffer, bigint32BEToBuffer, bigUint32BEToBuffer, readInt24BE, readUint24BE, Store, MaxTime} from '../../architect.mjs'
|
|
4
4
|
import {struct} from '../../generator.mjs'
|
|
5
5
|
|
|
6
6
|
const storage = new Storage(import.meta.url)
|
|
@@ -235,24 +235,30 @@ class AdminSet extends Entities {
|
|
|
235
235
|
throw new TypeError('stringToBuffer is not a function')
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
indexById(id) {
|
|
238
|
+
indexById(id, id_2) {
|
|
239
239
|
|
|
240
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
240
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
241
|
+
|
|
242
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
indexByUid(uid) {
|
|
245
|
+
indexByUid(uid, uid_2) {
|
|
246
|
+
|
|
247
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
244
248
|
|
|
245
|
-
return super.
|
|
249
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
246
250
|
}
|
|
247
251
|
|
|
248
|
-
indexByValid(valid) {
|
|
252
|
+
indexByValid(valid, valid_2) {
|
|
253
|
+
|
|
254
|
+
if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
|
|
249
255
|
|
|
250
|
-
return super.
|
|
256
|
+
return super.findByRange($valid, super.intToBuffer(valid, $valid), super.intToBuffer(valid_2, $valid))
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
indexByTime({after, before} = {}) {
|
|
254
260
|
|
|
255
|
-
return super.
|
|
261
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
256
262
|
}
|
|
257
263
|
}
|
|
258
264
|
|
|
@@ -291,24 +297,30 @@ class LogSet extends Entities {
|
|
|
291
297
|
throw new TypeError('stringToBuffer is not a function')
|
|
292
298
|
}
|
|
293
299
|
|
|
294
|
-
indexById(id) {
|
|
300
|
+
indexById(id, id_2) {
|
|
295
301
|
|
|
296
|
-
return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
302
|
+
if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
|
|
303
|
+
|
|
304
|
+
return super.findByRange($id, super.intToBuffer(id, $id), super.intToBuffer(id_2, $id))
|
|
297
305
|
}
|
|
298
306
|
|
|
299
|
-
indexByUid(uid) {
|
|
307
|
+
indexByUid(uid, uid_2) {
|
|
308
|
+
|
|
309
|
+
if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
|
|
300
310
|
|
|
301
|
-
return super.
|
|
311
|
+
return super.findByRange($uid, super.intToBuffer(uid, $uid), super.intToBuffer(uid_2, $uid))
|
|
302
312
|
}
|
|
303
313
|
|
|
304
|
-
indexByType(type) {
|
|
314
|
+
indexByType(type, type_2) {
|
|
315
|
+
|
|
316
|
+
if (type_2 === undefined) return super.findByValue($type, super.uintToBuffer(type, $type))
|
|
305
317
|
|
|
306
|
-
return super.
|
|
318
|
+
return super.findByRange($type, super.intToBuffer(type, $type), super.intToBuffer(type_2, $type))
|
|
307
319
|
}
|
|
308
320
|
|
|
309
321
|
indexByTime({after, before} = {}) {
|
|
310
322
|
|
|
311
|
-
return super.
|
|
323
|
+
return super.findByRange($time, d2b(after || 0), d2b(before || MaxTime))
|
|
312
324
|
}
|
|
313
325
|
}
|
|
314
326
|
|
package/test/8/type.ts
CHANGED
|
@@ -23,11 +23,12 @@ interface Admin {
|
|
|
23
23
|
time: Number | Date
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// @ts-ignore
|
|
26
27
|
interface AdminSet extends Array<Admin> {
|
|
27
28
|
|
|
28
|
-
indexById(id: Number): Array<Admin>
|
|
29
|
-
indexByUid(uid: String): Array<Admin>
|
|
30
|
-
indexByValid(valid: Number): Array<Admin>
|
|
29
|
+
indexById(id: Number, id_2?: Number): Array<Admin>
|
|
30
|
+
indexByUid(uid: String, uid_2?: String): Array<Admin>
|
|
31
|
+
indexByValid(valid: Number, valid_2?: Number): Array<Admin>
|
|
31
32
|
indexByTime({after, before}): Array<Admin>
|
|
32
33
|
/**
|
|
33
34
|
* 重写push方法
|
|
@@ -79,11 +80,12 @@ interface Log {
|
|
|
79
80
|
content: String
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// @ts-ignore
|
|
82
84
|
interface LogSet extends Array<Log> {
|
|
83
85
|
|
|
84
|
-
indexById(id: Number): Array<Log>
|
|
85
|
-
indexByUid(uid: String): Array<Log>
|
|
86
|
-
indexByType(type: Number): Array<Log>
|
|
86
|
+
indexById(id: Number, id_2?: Number): Array<Log>
|
|
87
|
+
indexByUid(uid: String, uid_2?: String): Array<Log>
|
|
88
|
+
indexByType(type: Number, type_2?: Number): Array<Log>
|
|
87
89
|
indexByTime({after, before}): Array<Log>
|
|
88
90
|
/**
|
|
89
91
|
* 重写push方法
|
|
@@ -136,6 +138,7 @@ interface Test3 {
|
|
|
136
138
|
test2: String
|
|
137
139
|
}
|
|
138
140
|
|
|
141
|
+
// @ts-ignore
|
|
139
142
|
interface Test3Set extends Array<Test3> {
|
|
140
143
|
|
|
141
144
|
/**
|