query-core 0.2.8 → 0.3.0

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.
@@ -21,7 +21,7 @@ exports.mssql = "mssql";
21
21
  exports.mysql = "mysql";
22
22
  exports.sqlite = "sqlite";
23
23
  var SearchBuilder = (function () {
24
- function SearchBuilder(query, table, attrs, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total) {
24
+ function SearchBuilder(query, table, attrs, provider, buildQ, fromDB, sort, q, excluding, buildSort, buildParam, total) {
25
25
  this.query = query;
26
26
  this.table = table;
27
27
  this.attrs = attrs;
@@ -99,8 +99,8 @@ var SearchBuilder = (function () {
99
99
  exports.SearchBuilder = SearchBuilder;
100
100
  var SqlSearchWriter = (function (_super) {
101
101
  __extends(SqlSearchWriter, _super);
102
- function SqlSearchWriter(manager, table, attributes, buildQ, provider, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) {
103
- var _this = _super.call(this, manager.query, table, attributes, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
102
+ function SqlSearchWriter(manager, table, attributes, provider, buildQ, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) {
103
+ var _this = _super.call(this, manager.query, table, attributes, provider, buildQ, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
104
104
  _this.attributes = attributes;
105
105
  _this.toDB = toDB;
106
106
  _this.exec = manager.exec;
@@ -154,8 +154,8 @@ var SqlSearchWriter = (function (_super) {
154
154
  exports.SqlSearchWriter = SqlSearchWriter;
155
155
  var SqlRepository = (function (_super) {
156
156
  __extends(SqlRepository, _super);
157
- function SqlRepository(manager, table, attributes, buildQ, provider, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) {
158
- var _this = _super.call(this, manager, table, attributes, buildQ, provider, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
157
+ function SqlRepository(manager, table, attributes, provider, buildQ, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) {
158
+ var _this = _super.call(this, manager, table, attributes, provider, buildQ, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
159
159
  _this.attributes = attributes;
160
160
  _this.toDB = toDB;
161
161
  _this.metadata = _this.metadata.bind(_this);
@@ -216,7 +216,7 @@ exports.SqlRepository = SqlRepository;
216
216
  var Query = (function (_super) {
217
217
  __extends(Query, _super);
218
218
  function Query(query, table, attributes, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total) {
219
- var _this = _super.call(this, query, table, attributes, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
219
+ var _this = _super.call(this, query, table, attributes, provider, buildQ, fromDB, sort, q, excluding, buildSort, buildParam, total) || this;
220
220
  var m = build_1.metadata(attributes);
221
221
  _this.primaryKeys = m.keys;
222
222
  _this.map = m.map;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-core",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "query",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
@@ -34,9 +34,10 @@ export class SearchBuilder<T, S> {
34
34
  protected query: <K>(sql: string, args?: any[], m?: StringMap, bools?: Attribute[], ctx?: any) => Promise<K[]>,
35
35
  protected table: string,
36
36
  protected attrs?: Attributes,
37
+ protected provider?: string,
37
38
  buildQ?: (
38
39
  s: S,
39
- bparam: (i: number) => string,
40
+ param: (i: number) => string,
40
41
  sort?: string,
41
42
  buildSort3?: (sort?: string, map?: Attributes | StringMap) => string,
42
43
  attrs?: Attributes,
@@ -46,7 +47,6 @@ export class SearchBuilder<T, S> {
46
47
  strExcluding?: string,
47
48
  likeType?: LikeType
48
49
  ) => Statement | undefined,
49
- protected provider?: string,
50
50
  protected fromDB?: (v: T) => T,
51
51
  protected sort?: string,
52
52
  q?: string,
@@ -122,6 +122,7 @@ export class SqlSearchWriter<T, S> extends SearchBuilder<T, S> {
122
122
  manager: Manager,
123
123
  table: string,
124
124
  protected attributes: Attributes,
125
+ provider?: string,
125
126
  buildQ?: (
126
127
  s: S,
127
128
  param: (i: number) => string,
@@ -134,7 +135,6 @@ export class SqlSearchWriter<T, S> extends SearchBuilder<T, S> {
134
135
  strExcluding?: string,
135
136
  likeType?: LikeType
136
137
  ) => Statement | undefined,
137
- provider?: string,
138
138
  protected toDB?: (v: T) => T,
139
139
  fromDB?: (v: T) => T,
140
140
  sort?: string,
@@ -144,7 +144,7 @@ export class SqlSearchWriter<T, S> extends SearchBuilder<T, S> {
144
144
  buildParam?: (i: number) => string,
145
145
  total?: string,
146
146
  ) {
147
- super(manager.query, table, attributes, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total)
147
+ super(manager.query, table, attributes, provider, buildQ, fromDB, sort, q, excluding, buildSort, buildParam, total)
148
148
  this.exec = manager.exec
149
149
  const x = version(attributes)
150
150
  if (x) {
@@ -194,9 +194,10 @@ export class SqlRepository<T, ID, S> extends SqlSearchWriter<T, S> {
194
194
  manager: Manager,
195
195
  table: string,
196
196
  protected attributes: Attributes,
197
+ provider?: string,
197
198
  buildQ?: (
198
199
  s: S,
199
- bparam: LikeType | ((i: number) => string),
200
+ param: (i: number) => string,
200
201
  sort?: string,
201
202
  buildSort3?: (sort?: string, map?: Attributes | StringMap) => string,
202
203
  attrs?: Attributes,
@@ -204,8 +205,8 @@ export class SqlRepository<T, ID, S> extends SqlSearchWriter<T, S> {
204
205
  fields?: string[],
205
206
  sq?: string,
206
207
  strExcluding?: string,
208
+ likeType?: LikeType
207
209
  ) => Statement | undefined,
208
- provider?: string,
209
210
  protected toDB?: (v: T) => T,
210
211
  fromDB?: (v: T) => T,
211
212
  sort?: string,
@@ -215,7 +216,7 @@ export class SqlRepository<T, ID, S> extends SqlSearchWriter<T, S> {
215
216
  buildParam?: (i: number) => string,
216
217
  total?: string,
217
218
  ) {
218
- super(manager, table, attributes, buildQ, provider, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total)
219
+ super(manager, table, attributes, provider, buildQ, toDB, fromDB, sort, q, excluding, buildSort, buildParam, total)
219
220
  this.metadata = this.metadata.bind(this)
220
221
  this.all = this.all.bind(this)
221
222
  this.load = this.load.bind(this)
@@ -277,7 +278,7 @@ export class Query<T, ID, S> extends SearchBuilder<T, S> {
277
278
  attributes: Attributes,
278
279
  buildQ?: (
279
280
  s: S,
280
- bparam: LikeType | ((i: number) => string),
281
+ param: (i: number) => string,
281
282
  sort?: string,
282
283
  buildSort3?: (sort?: string, map?: Attributes | StringMap) => string,
283
284
  attrs?: Attributes,
@@ -285,6 +286,7 @@ export class Query<T, ID, S> extends SearchBuilder<T, S> {
285
286
  fields?: string[],
286
287
  sq?: string,
287
288
  strExcluding?: string,
289
+ likeType?: LikeType
288
290
  ) => Statement | undefined,
289
291
  provider?: string,
290
292
  fromDB?: (v: T) => T,
@@ -295,7 +297,7 @@ export class Query<T, ID, S> extends SearchBuilder<T, S> {
295
297
  buildParam?: (i: number) => string,
296
298
  total?: string,
297
299
  ) {
298
- super(query, table, attributes, buildQ, provider, fromDB, sort, q, excluding, buildSort, buildParam, total)
300
+ super(query, table, attributes, provider, buildQ, fromDB, sort, q, excluding, buildSort, buildParam, total)
299
301
  const m = metadata(attributes)
300
302
  this.primaryKeys = m.keys
301
303
  this.map = m.map