@k3000/store 0.5.0 → 0.6.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/generator.mjs CHANGED
@@ -236,6 +236,13 @@ export const Uint = size => new class Uint extends Type {
236
236
  return super.step(SCOPE, step > 0 ? step : 1);
237
237
  }
238
238
 
239
+ length(length) {
240
+
241
+ length = Number.parseInt(length) || TypeLen.int
242
+
243
+ return super.length(SCOPE, length > 0 && length < TypeLen.int ? length : TypeLen.int);
244
+ }
245
+
239
246
  }()
240
247
 
241
248
  /**
@@ -287,6 +294,13 @@ export const Int = size => new class Int extends Type {
287
294
  return super.step(SCOPE, step === 0 ? 1 : step);
288
295
  }
289
296
 
297
+ length(length) {
298
+
299
+ length = Number.parseInt(length) || TypeLen.int
300
+
301
+ return super.length(SCOPE, length > 0 && length < TypeLen.int ? length : TypeLen.int);
302
+ }
303
+
290
304
  }()
291
305
 
292
306
  export const BigUint = remark => new class BigUint extends Type {
@@ -1167,6 +1181,14 @@ interface ${key}Set extends Array<${key}> {
1167
1181
  indexBy${Key}({after, before}): Array<${key}>` : `
1168
1182
  indexBy${Key}(${k}: ${gen.type[value.type]}): Array<${key}>`
1169
1183
  }).join('')}
1184
+ /**
1185
+ * 重写push方法
1186
+ */
1187
+ push(...item: Array<${key}>): Array<${key}>
1188
+ /**
1189
+ * 重写unshift方法
1190
+ */
1191
+ unshift(...item: Array<${key}>): Array<${key}>
1170
1192
  /**
1171
1193
  * 分页查询
1172
1194
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k3000/store",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "storage",
5
5
  "main": "generator.mjs",
6
6
  "scripts": {
package/test/0/index.mjs CHANGED
@@ -8,7 +8,7 @@ export const remark = Symbol('remark')
8
8
 
9
9
  export const close = () => storage.close()
10
10
 
11
- export const getStruct = () => struct(storage, remark)
11
+ export const getStruct = name => struct(storage, remark, name)
12
12
 
13
13
  export default new class extends Store {
14
14
 
package/test/1/data CHANGED
Binary file
package/test/1/index CHANGED
Binary file
package/test/1/index.mjs CHANGED
@@ -387,7 +387,7 @@ export const remark = Symbol('remark')
387
387
 
388
388
  export const close = () => storage.close()
389
389
 
390
- export const getStruct = () => struct(storage, remark)
390
+ export const getStruct = name => struct(storage, remark, name)
391
391
 
392
392
  /**
393
393
  * @type {import('./type').Storage}
package/test/2/data CHANGED
Binary file
package/test/2/index CHANGED
Binary file
package/test/2/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -141,6 +157,14 @@ interface Test {
141
157
  interface TestSet extends Array<Test> {
142
158
 
143
159
  indexById(id: Number): Array<Test>
160
+ /**
161
+ * 重写push方法
162
+ */
163
+ push(...item: Array<Test>): Array<Test>
164
+ /**
165
+ * 重写unshift方法
166
+ */
167
+ unshift(...item: Array<Test>): Array<Test>
144
168
  /**
145
169
  * 分页查询
146
170
  */
@@ -182,6 +206,14 @@ interface Test2 {
182
206
 
183
207
  interface Test2Set extends Array<Test2> {
184
208
 
209
+ /**
210
+ * 重写push方法
211
+ */
212
+ push(...item: Array<Test2>): Array<Test2>
213
+ /**
214
+ * 重写unshift方法
215
+ */
216
+ unshift(...item: Array<Test2>): Array<Test2>
185
217
  /**
186
218
  * 分页查询
187
219
  */
package/test/3/data CHANGED
Binary file
package/test/3/index CHANGED
Binary file
package/test/3/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -141,6 +157,14 @@ interface Test {
141
157
  interface TestSet extends Array<Test> {
142
158
 
143
159
  indexById(id: Number): Array<Test>
160
+ /**
161
+ * 重写push方法
162
+ */
163
+ push(...item: Array<Test>): Array<Test>
164
+ /**
165
+ * 重写unshift方法
166
+ */
167
+ unshift(...item: Array<Test>): Array<Test>
144
168
  /**
145
169
  * 分页查询
146
170
  */
@@ -186,6 +210,14 @@ interface Test2 {
186
210
 
187
211
  interface Test2Set extends Array<Test2> {
188
212
 
213
+ /**
214
+ * 重写push方法
215
+ */
216
+ push(...item: Array<Test2>): Array<Test2>
217
+ /**
218
+ * 重写unshift方法
219
+ */
220
+ unshift(...item: Array<Test2>): Array<Test2>
189
221
  /**
190
222
  * 分页查询
191
223
  */
package/test/4/data CHANGED
Binary file
package/test/4/index CHANGED
Binary file
package/test/4/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -141,6 +157,14 @@ interface Test {
141
157
  interface TestSet extends Array<Test> {
142
158
 
143
159
  indexById(id: Number): Array<Test>
160
+ /**
161
+ * 重写push方法
162
+ */
163
+ push(...item: Array<Test>): Array<Test>
164
+ /**
165
+ * 重写unshift方法
166
+ */
167
+ unshift(...item: Array<Test>): Array<Test>
144
168
  /**
145
169
  * 分页查询
146
170
  */
@@ -186,6 +210,14 @@ interface Test3 {
186
210
 
187
211
  interface Test3Set extends Array<Test3> {
188
212
 
213
+ /**
214
+ * 重写push方法
215
+ */
216
+ push(...item: Array<Test3>): Array<Test3>
217
+ /**
218
+ * 重写unshift方法
219
+ */
220
+ unshift(...item: Array<Test3>): Array<Test3>
189
221
  /**
190
222
  * 分页查询
191
223
  */
package/test/5/data CHANGED
Binary file
package/test/5/index CHANGED
Binary file
package/test/5/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -141,6 +157,14 @@ interface Test {
141
157
  interface TestSet extends Array<Test> {
142
158
 
143
159
  indexById(id: Number): Array<Test>
160
+ /**
161
+ * 重写push方法
162
+ */
163
+ push(...item: Array<Test>): Array<Test>
164
+ /**
165
+ * 重写unshift方法
166
+ */
167
+ unshift(...item: Array<Test>): Array<Test>
144
168
  /**
145
169
  * 分页查询
146
170
  */
@@ -186,6 +210,14 @@ interface Test3 {
186
210
 
187
211
  interface Test3Set extends Array<Test3> {
188
212
 
213
+ /**
214
+ * 重写push方法
215
+ */
216
+ push(...item: Array<Test3>): Array<Test3>
217
+ /**
218
+ * 重写unshift方法
219
+ */
220
+ unshift(...item: Array<Test3>): Array<Test3>
189
221
  /**
190
222
  * 分页查询
191
223
  */
package/test/6/data CHANGED
Binary file
package/test/6/index CHANGED
Binary file
package/test/6/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -117,6 +133,14 @@ interface Test3 {
117
133
 
118
134
  interface Test3Set extends Array<Test3> {
119
135
 
136
+ /**
137
+ * 重写push方法
138
+ */
139
+ push(...item: Array<Test3>): Array<Test3>
140
+ /**
141
+ * 重写unshift方法
142
+ */
143
+ unshift(...item: Array<Test3>): Array<Test3>
120
144
  /**
121
145
  * 分页查询
122
146
  */
package/test/7/data CHANGED
Binary file
package/test/7/index CHANGED
Binary file
package/test/7/type.ts CHANGED
@@ -29,6 +29,14 @@ interface AdminSet extends Array<Admin> {
29
29
  indexByUid(uid: String): Array<Admin>
30
30
  indexByValid(valid: Number): Array<Admin>
31
31
  indexByTime({after, before}): Array<Admin>
32
+ /**
33
+ * 重写push方法
34
+ */
35
+ push(...item: Array<Admin>): Array<Admin>
36
+ /**
37
+ * 重写unshift方法
38
+ */
39
+ unshift(...item: Array<Admin>): Array<Admin>
32
40
  /**
33
41
  * 分页查询
34
42
  */
@@ -76,6 +84,14 @@ interface LogSet extends Array<Log> {
76
84
  indexById(id: Number): Array<Log>
77
85
  indexByUid(uid: String): Array<Log>
78
86
  indexByTime({after, before}): Array<Log>
87
+ /**
88
+ * 重写push方法
89
+ */
90
+ push(...item: Array<Log>): Array<Log>
91
+ /**
92
+ * 重写unshift方法
93
+ */
94
+ unshift(...item: Array<Log>): Array<Log>
79
95
  /**
80
96
  * 分页查询
81
97
  */
@@ -117,6 +133,14 @@ interface Test3 {
117
133
 
118
134
  interface Test3Set extends Array<Test3> {
119
135
 
136
+ /**
137
+ * 重写push方法
138
+ */
139
+ push(...item: Array<Test3>): Array<Test3>
140
+ /**
141
+ * 重写unshift方法
142
+ */
143
+ unshift(...item: Array<Test3>): Array<Test3>
120
144
  /**
121
145
  * 分页查询
122
146
  */