@sqb/builder 4.26.1 → 5.0.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.
- package/index.d.ts +4 -14
- package/index.js +4 -14
- package/op.ns.d.ts +64 -0
- package/op.ns.js +65 -0
- package/package.json +1 -1
- package/serializable.d.ts +10 -3
- package/serializable.js +7 -2
- package/serialize-context.d.ts +2 -2
- package/serialize-context.js +1 -1
- package/{query/delete-query.d.ts → sql/delete.d.ts} +14 -6
- package/{query/delete-query.js → sql/delete.js} +24 -20
- package/sql/elements/base-field.d.ts +18 -0
- package/sql/elements/base-field.js +12 -0
- package/{sql-objects/case-statement.d.ts → sql/elements/case.d.ts} +17 -9
- package/{sql-objects/case-statement.js → sql/elements/case.js} +13 -9
- package/sql/elements/coalesce.d.ts +30 -0
- package/{sql-objects/coalesce-statement.js → sql/elements/coalesce.js} +11 -7
- package/sql/elements/count.d.ts +29 -0
- package/{sql-objects/count-statement.js → sql/elements/count.js} +10 -3
- package/sql/elements/field.d.ts +27 -0
- package/sql/elements/field.js +54 -0
- package/sql/elements/group-column.d.ts +16 -0
- package/{sql-objects → sql/elements}/group-column.js +19 -15
- package/sql/elements/index.d.ts +26 -0
- package/sql/elements/index.js +26 -0
- package/sql/elements/join-cross.d.ts +15 -0
- package/sql/elements/join-cross.js +11 -0
- package/sql/elements/join-full-outer.d.ts +15 -0
- package/sql/elements/join-full-outer.js +11 -0
- package/sql/elements/join-inner.d.ts +15 -0
- package/sql/elements/join-inner.js +11 -0
- package/sql/elements/join-left-outer.d.ts +15 -0
- package/sql/elements/join-left-outer.js +11 -0
- package/sql/elements/join-left.d.ts +15 -0
- package/sql/elements/join-left.js +11 -0
- package/sql/elements/join-outer.d.ts +15 -0
- package/sql/elements/join-outer.js +11 -0
- package/sql/elements/join-right-outer.d.ts +15 -0
- package/sql/elements/join-right-outer.js +11 -0
- package/sql/elements/join-right.d.ts +15 -0
- package/sql/elements/join-right.js +11 -0
- package/sql/elements/join.d.ts +25 -0
- package/{sql-objects/join-statement.js → sql/elements/join.js} +24 -19
- package/sql/elements/lower.d.ts +30 -0
- package/{sql-objects/lower-statement.js → sql/elements/lower.js} +11 -7
- package/{sql-objects/min-statement.d.ts → sql/elements/max.d.ts} +13 -5
- package/{sql-objects/max-statement.js → sql/elements/max.js} +11 -7
- package/{sql-objects/lower-statement.d.ts → sql/elements/min.d.ts} +13 -4
- package/{sql-objects/min-statement.js → sql/elements/min.js} +10 -3
- package/sql/elements/order-column.d.ts +17 -0
- package/sql/elements/order-column.js +43 -0
- package/sql/elements/param.d.ts +36 -0
- package/{sql-objects/param-expression.js → sql/elements/param.js} +26 -13
- package/sql/elements/raw.d.ts +17 -0
- package/sql/elements/raw.js +19 -0
- package/sql/elements/returning-column.d.ts +17 -0
- package/sql/elements/returning-column.js +32 -0
- package/sql/elements/sequence.d.ts +32 -0
- package/{sql-objects/sequence-getter-statement.js → sql/elements/sequence.js} +12 -8
- package/{sql-objects/string-agg-statement.d.ts → sql/elements/string-agg.d.ts} +13 -5
- package/{sql-objects/string-agg-statement.js → sql/elements/string-agg.js} +15 -12
- package/sql/elements/table-name.d.ts +32 -0
- package/sql/elements/table-name.js +59 -0
- package/sql/elements/upper.d.ts +30 -0
- package/{sql-objects/upper-statement.js → sql/elements/upper.js} +11 -7
- package/sql/index.d.ts +9 -0
- package/sql/index.js +9 -0
- package/sql/insert.d.ts +37 -0
- package/{query/insert-query.js → sql/insert.js} +33 -18
- package/sql/operators/and.d.ts +14 -0
- package/sql/operators/and.js +13 -0
- package/sql/operators/between.d.ts +18 -0
- package/{sql-objects/operators/op-between.js → sql/operators/between.js} +20 -8
- package/sql/operators/comp-operator.d.ts +24 -0
- package/{sql-objects → sql}/operators/comp-operator.js +27 -21
- package/sql/operators/eq.d.ts +13 -0
- package/sql/operators/eq.js +23 -0
- package/sql/operators/exists.d.ts +17 -0
- package/sql/operators/exists.js +31 -0
- package/sql/operators/gt.d.ts +13 -0
- package/sql/operators/gt.js +20 -0
- package/sql/operators/gte.d.ts +13 -0
- package/sql/operators/gte.js +20 -0
- package/sql/operators/i-like.d.ts +13 -0
- package/sql/operators/i-like.js +21 -0
- package/sql/operators/in.d.ts +15 -0
- package/sql/operators/in.js +27 -0
- package/sql/operators/index.d.ts +24 -0
- package/sql/operators/index.js +24 -0
- package/sql/operators/is-not.d.ts +13 -0
- package/sql/operators/is-not.js +13 -0
- package/sql/operators/is.d.ts +13 -0
- package/sql/operators/is.js +20 -0
- package/sql/operators/like.d.ts +15 -0
- package/sql/operators/like.js +27 -0
- package/sql/operators/logical-operator.d.ts +15 -0
- package/sql/operators/logical-operator.js +86 -0
- package/sql/operators/lt.d.ts +13 -0
- package/sql/operators/lt.js +20 -0
- package/sql/operators/lte.d.ts +13 -0
- package/sql/operators/lte.js +20 -0
- package/sql/operators/ne.d.ts +13 -0
- package/sql/operators/ne.js +20 -0
- package/sql/operators/not-between.d.ts +15 -0
- package/sql/operators/not-between.js +13 -0
- package/sql/operators/not-exists.d.ts +14 -0
- package/sql/operators/not-exists.js +13 -0
- package/sql/operators/not-i-like.d.ts +13 -0
- package/sql/operators/not-i-like.js +13 -0
- package/sql/operators/not-in.d.ts +13 -0
- package/sql/operators/not-in.js +13 -0
- package/sql/operators/not-like.d.ts +13 -0
- package/sql/operators/not-like.js +13 -0
- package/sql/operators/not.d.ts +18 -0
- package/sql/operators/not.js +20 -0
- package/sql/operators/operator.d.ts +12 -0
- package/sql/operators/operator.js +11 -0
- package/sql/operators/or.d.ts +12 -0
- package/sql/operators/or.js +12 -0
- package/sql/query.d.ts +31 -0
- package/{query → sql}/query.js +13 -7
- package/sql/returning-query.d.ts +23 -0
- package/{query → sql}/returning-query.js +13 -3
- package/{query/select-query.d.ts → sql/select.d.ts} +20 -12
- package/{query/select-query.js → sql/select.js} +21 -17
- package/{query/union-query.d.ts → sql/union.d.ts} +10 -2
- package/{query/union-query.js → sql/union.js} +10 -6
- package/sql/update.d.ts +38 -0
- package/{query/update-query.js → sql/update.js} +34 -25
- package/type-guards.d.ts +21 -0
- package/{typeguards.js → type-guards.js} +10 -10
- package/classes.ns.d.ts +0 -38
- package/classes.ns.js +0 -38
- package/op.initializers.d.ts +0 -89
- package/op.initializers.js +0 -131
- package/query/insert-query.d.ts +0 -23
- package/query/query.d.ts +0 -25
- package/query/returning-query.d.ts +0 -14
- package/query/update-query.d.ts +0 -29
- package/sql-objects/base-field.d.ts +0 -7
- package/sql-objects/base-field.js +0 -7
- package/sql-objects/coalesce-statement.d.ts +0 -22
- package/sql-objects/count-statement.d.ts +0 -20
- package/sql-objects/expression.d.ts +0 -7
- package/sql-objects/expression.js +0 -6
- package/sql-objects/field-expression.d.ts +0 -14
- package/sql-objects/field-expression.js +0 -50
- package/sql-objects/group-column.d.ts +0 -8
- package/sql-objects/join-statement.d.ts +0 -17
- package/sql-objects/max-statement.d.ts +0 -22
- package/sql-objects/operator.d.ts +0 -5
- package/sql-objects/operator.js +0 -3
- package/sql-objects/operators/comp-operator.d.ts +0 -16
- package/sql-objects/operators/logical-operator.d.ts +0 -16
- package/sql-objects/operators/logical-operator.js +0 -81
- package/sql-objects/operators/op-and.d.ts +0 -5
- package/sql-objects/operators/op-and.js +0 -5
- package/sql-objects/operators/op-between.d.ts +0 -11
- package/sql-objects/operators/op-eq.d.ts +0 -8
- package/sql-objects/operators/op-eq.js +0 -9
- package/sql-objects/operators/op-exists.d.ts +0 -11
- package/sql-objects/operators/op-exists.js +0 -27
- package/sql-objects/operators/op-gt.d.ts +0 -8
- package/sql-objects/operators/op-gt.js +0 -9
- package/sql-objects/operators/op-gte.d.ts +0 -8
- package/sql-objects/operators/op-gte.js +0 -9
- package/sql-objects/operators/op-ilike.d.ts +0 -6
- package/sql-objects/operators/op-ilike.js +0 -6
- package/sql-objects/operators/op-in.d.ts +0 -9
- package/sql-objects/operators/op-in.js +0 -15
- package/sql-objects/operators/op-is-not.d.ts +0 -8
- package/sql-objects/operators/op-is-not.js +0 -9
- package/sql-objects/operators/op-is.d.ts +0 -8
- package/sql-objects/operators/op-is.js +0 -9
- package/sql-objects/operators/op-like.d.ts +0 -10
- package/sql-objects/operators/op-like.js +0 -16
- package/sql-objects/operators/op-lt.d.ts +0 -8
- package/sql-objects/operators/op-lt.js +0 -9
- package/sql-objects/operators/op-lte.d.ts +0 -8
- package/sql-objects/operators/op-lte.js +0 -9
- package/sql-objects/operators/op-ne.d.ts +0 -8
- package/sql-objects/operators/op-ne.js +0 -9
- package/sql-objects/operators/op-not-between.d.ts +0 -6
- package/sql-objects/operators/op-not-between.js +0 -6
- package/sql-objects/operators/op-not-exists.d.ts +0 -6
- package/sql-objects/operators/op-not-exists.js +0 -6
- package/sql-objects/operators/op-not-ilike.d.ts +0 -6
- package/sql-objects/operators/op-not-ilike.js +0 -6
- package/sql-objects/operators/op-not-in.d.ts +0 -6
- package/sql-objects/operators/op-not-in.js +0 -6
- package/sql-objects/operators/op-not-like.d.ts +0 -6
- package/sql-objects/operators/op-not-like.js +0 -6
- package/sql-objects/operators/op-not.d.ts +0 -11
- package/sql-objects/operators/op-not.js +0 -17
- package/sql-objects/operators/op-or.d.ts +0 -5
- package/sql-objects/operators/op-or.js +0 -5
- package/sql-objects/order-column.d.ts +0 -9
- package/sql-objects/order-column.js +0 -39
- package/sql-objects/param-expression.d.ts +0 -23
- package/sql-objects/raw-statement.d.ts +0 -9
- package/sql-objects/raw-statement.js +0 -15
- package/sql-objects/returning-column.d.ts +0 -9
- package/sql-objects/returning-column.js +0 -27
- package/sql-objects/sequence-getter-statement.d.ts +0 -24
- package/sql-objects/table-name.d.ts +0 -22
- package/sql-objects/table-name.js +0 -55
- package/sql-objects/upper-statement.d.ts +0 -22
- package/sqlobject.initializers.d.ts +0 -61
- package/sqlobject.initializers.js +0 -115
- package/typeguards.d.ts +0 -37
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { OperatorType, SerializationType } from '../../enums.js';
|
|
2
|
-
import { Operator } from '../operator.js';
|
|
3
|
-
export class OpNot extends Operator {
|
|
4
|
-
_operatorType = OperatorType.not;
|
|
5
|
-
_expression;
|
|
6
|
-
constructor(expression) {
|
|
7
|
-
super();
|
|
8
|
-
this._expression = expression;
|
|
9
|
-
}
|
|
10
|
-
get _type() {
|
|
11
|
-
return SerializationType.NEGATIVE_EXPRESSION;
|
|
12
|
-
}
|
|
13
|
-
_serialize(ctx) {
|
|
14
|
-
const expression = ctx.anyToSQL(this._expression);
|
|
15
|
-
return ctx.serialize(this._type, expression, () => expression ? 'not ' + expression : '');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
3
|
-
import { BaseField } from './base-field.js';
|
|
4
|
-
export declare class OrderColumn extends BaseField {
|
|
5
|
-
_descending?: boolean;
|
|
6
|
-
constructor(value: string);
|
|
7
|
-
get _type(): SerializationType;
|
|
8
|
-
_serialize(ctx: SerializeContext): string;
|
|
9
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { BaseField } from './base-field.js';
|
|
3
|
-
const ORDER_COLUMN_PATTERN = /^([-+])?((?:[a-zA-Z_][\w$]*\.){0,2})([a-zA-Z_][\w$]*|\*) *(asc|dsc|desc|ascending|descending)?$/i;
|
|
4
|
-
export class OrderColumn extends BaseField {
|
|
5
|
-
_descending;
|
|
6
|
-
constructor(value) {
|
|
7
|
-
super();
|
|
8
|
-
const m = value.match(ORDER_COLUMN_PATTERN);
|
|
9
|
-
if (!m)
|
|
10
|
-
throw new TypeError(`"${value}" does not match order column format`);
|
|
11
|
-
this._field = m[3];
|
|
12
|
-
if (m[2]) {
|
|
13
|
-
const a = m[2].split(/\./g);
|
|
14
|
-
a.pop();
|
|
15
|
-
this._table = a.pop();
|
|
16
|
-
this._schema = a.pop();
|
|
17
|
-
}
|
|
18
|
-
this._descending = !!(m[1] === '-' ||
|
|
19
|
-
(!m[1] &&
|
|
20
|
-
m[4] &&
|
|
21
|
-
['dsc', 'desc', 'descending'].includes(m[4].toLowerCase())));
|
|
22
|
-
}
|
|
23
|
-
get _type() {
|
|
24
|
-
return SerializationType.ORDER_COLUMN;
|
|
25
|
-
}
|
|
26
|
-
_serialize(ctx) {
|
|
27
|
-
const o = {
|
|
28
|
-
schema: this._schema,
|
|
29
|
-
table: this._table,
|
|
30
|
-
field: this._field,
|
|
31
|
-
descending: !!this._descending,
|
|
32
|
-
isReservedWord: !!(this._field && ctx.isReservedWord(this._field)),
|
|
33
|
-
};
|
|
34
|
-
return ctx.serialize(this._type, o, () => (o.schema ? o.schema + '.' : '') +
|
|
35
|
-
(o.table ? o.table + '.' : '') +
|
|
36
|
-
(o.isReservedWord ? '"' + o.field + '"' : o.field) +
|
|
37
|
-
(o.descending ? ' desc' : ''));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DataType, SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
4
|
-
export declare class ParamExpression extends Serializable {
|
|
5
|
-
_name: string;
|
|
6
|
-
_dataType?: DataType;
|
|
7
|
-
_isArray?: boolean;
|
|
8
|
-
constructor(arg: string | {
|
|
9
|
-
name: string;
|
|
10
|
-
dataType?: DataType;
|
|
11
|
-
isArray?: boolean;
|
|
12
|
-
});
|
|
13
|
-
get _type(): SerializationType;
|
|
14
|
-
/**
|
|
15
|
-
* Performs serialization
|
|
16
|
-
*/
|
|
17
|
-
_serialize(ctx: SerializeContext): string;
|
|
18
|
-
protected __defaultSerialize(ctx: SerializeContext, o: {
|
|
19
|
-
name: string;
|
|
20
|
-
dataType?: DataType;
|
|
21
|
-
isArray?: boolean;
|
|
22
|
-
}): string;
|
|
23
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
4
|
-
export declare class RawStatement extends Serializable {
|
|
5
|
-
_text: string;
|
|
6
|
-
constructor(str: string);
|
|
7
|
-
get _type(): SerializationType;
|
|
8
|
-
_serialize(ctx: SerializeContext): string;
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
export class RawStatement extends Serializable {
|
|
4
|
-
_text;
|
|
5
|
-
constructor(str) {
|
|
6
|
-
super();
|
|
7
|
-
this._text = str;
|
|
8
|
-
}
|
|
9
|
-
get _type() {
|
|
10
|
-
return SerializationType.RAW;
|
|
11
|
-
}
|
|
12
|
-
_serialize(ctx) {
|
|
13
|
-
return ctx.serialize(this._type, this._text, () => this._text);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
3
|
-
import { BaseField } from './base-field.js';
|
|
4
|
-
export declare class ReturningColumn extends BaseField {
|
|
5
|
-
_alias: string;
|
|
6
|
-
constructor(field: string);
|
|
7
|
-
get _type(): SerializationType;
|
|
8
|
-
_serialize(ctx: SerializeContext): string;
|
|
9
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { BaseField } from './base-field.js';
|
|
3
|
-
const RETURNING_COLUMN_PATTERN = /^([a-zA-Z_]\w*) *(?:as)? *(\w+)?$/;
|
|
4
|
-
export class ReturningColumn extends BaseField {
|
|
5
|
-
_alias;
|
|
6
|
-
constructor(field) {
|
|
7
|
-
super();
|
|
8
|
-
const m = field.match(RETURNING_COLUMN_PATTERN);
|
|
9
|
-
if (!m)
|
|
10
|
-
throw new TypeError(`"${field}" does not match returning column format`);
|
|
11
|
-
this._field = m[1];
|
|
12
|
-
this._alias = m[2];
|
|
13
|
-
}
|
|
14
|
-
get _type() {
|
|
15
|
-
return SerializationType.RETURNING_COLUMN;
|
|
16
|
-
}
|
|
17
|
-
_serialize(ctx) {
|
|
18
|
-
const o = {
|
|
19
|
-
field: this._field,
|
|
20
|
-
alias: this._alias,
|
|
21
|
-
};
|
|
22
|
-
ctx.returningFields = ctx.returningFields || [];
|
|
23
|
-
ctx.returningFields.push(o);
|
|
24
|
-
return ctx.serialize(this._type, o, () => ctx.escapeReserved(o.field) +
|
|
25
|
-
(o.alias ? ' as ' + ctx.escapeReserved(o.alias) : ''));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
4
|
-
export declare class SequenceGetterStatement extends Serializable {
|
|
5
|
-
_expression: string;
|
|
6
|
-
_next: boolean;
|
|
7
|
-
_alias?: string;
|
|
8
|
-
constructor(expression: string, next?: boolean);
|
|
9
|
-
get _type(): SerializationType;
|
|
10
|
-
next(value: boolean): this;
|
|
11
|
-
/**
|
|
12
|
-
* Sets alias to case expression.
|
|
13
|
-
*/
|
|
14
|
-
as(alias: string): this;
|
|
15
|
-
/**
|
|
16
|
-
* Performs serialization
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} ctx
|
|
19
|
-
* @return {string}
|
|
20
|
-
* @override
|
|
21
|
-
*/
|
|
22
|
-
_serialize(ctx: SerializeContext): string;
|
|
23
|
-
protected __defaultSerialize(ctx: SerializeContext, o: any): string;
|
|
24
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
4
|
-
export interface OptimizerHintArgs {
|
|
5
|
-
hint: string;
|
|
6
|
-
dialect?: string[];
|
|
7
|
-
}
|
|
8
|
-
export interface TableNameArgs {
|
|
9
|
-
schema?: string;
|
|
10
|
-
table: string;
|
|
11
|
-
alias?: string;
|
|
12
|
-
optimizerHint?: string | string[] | OptimizerHintArgs | OptimizerHintArgs[];
|
|
13
|
-
}
|
|
14
|
-
export declare class TableName extends Serializable {
|
|
15
|
-
schema?: string;
|
|
16
|
-
table?: string;
|
|
17
|
-
alias?: string;
|
|
18
|
-
optimizerHint?: OptimizerHintArgs[];
|
|
19
|
-
constructor(tableName: string | TableNameArgs);
|
|
20
|
-
get _type(): SerializationType;
|
|
21
|
-
_serialize(ctx: SerializeContext): string;
|
|
22
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
export class TableName extends Serializable {
|
|
4
|
-
schema;
|
|
5
|
-
table;
|
|
6
|
-
alias;
|
|
7
|
-
optimizerHint;
|
|
8
|
-
constructor(tableName) {
|
|
9
|
-
super();
|
|
10
|
-
if (typeof tableName === 'string') {
|
|
11
|
-
const m = tableName.match(/^(?:([a-zA-Z][\w$]*)\.)? *([a-zA-Z][\w$]*) *(?:as)? *(\w+)?$/);
|
|
12
|
-
if (!m)
|
|
13
|
-
throw new TypeError(`(${tableName}) does not match table name format`);
|
|
14
|
-
if (m[1])
|
|
15
|
-
this.schema = m[1];
|
|
16
|
-
if (m[2])
|
|
17
|
-
this.table = m[2];
|
|
18
|
-
if (m[3])
|
|
19
|
-
this.alias = m[3];
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.schema = tableName.schema;
|
|
23
|
-
this.table = tableName.table;
|
|
24
|
-
this.alias = tableName.alias;
|
|
25
|
-
if (tableName.optimizerHint) {
|
|
26
|
-
const arg0 = tableName.optimizerHint;
|
|
27
|
-
this.optimizerHint = [];
|
|
28
|
-
if (typeof arg0 === 'object' && !Array.isArray(arg0)) {
|
|
29
|
-
this.optimizerHint.push({
|
|
30
|
-
hint: String(arg0.hint),
|
|
31
|
-
dialect: Array.isArray(arg0.dialect) ? arg0.dialect : undefined,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.optimizerHint.push({
|
|
36
|
-
hint: String(arg0),
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
get _type() {
|
|
43
|
-
return SerializationType.TABLE_NAME;
|
|
44
|
-
}
|
|
45
|
-
_serialize(ctx) {
|
|
46
|
-
return ctx.serialize(this._type, {
|
|
47
|
-
schema: this.schema,
|
|
48
|
-
table: this.table,
|
|
49
|
-
alias: this.alias,
|
|
50
|
-
optimizerHint: this.optimizerHint,
|
|
51
|
-
}, () => (this.schema ? this.schema + '.' : '') +
|
|
52
|
-
this.table +
|
|
53
|
-
(this.alias ? ' ' + this.alias : ''));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SerializationType } from '../enums.js';
|
|
2
|
-
import { Serializable } from '../serializable.js';
|
|
3
|
-
import { SerializeContext } from '../serialize-context.js';
|
|
4
|
-
export declare class UpperStatement extends Serializable {
|
|
5
|
-
_expression: any;
|
|
6
|
-
_alias?: string;
|
|
7
|
-
constructor(expression: any);
|
|
8
|
-
get _type(): SerializationType;
|
|
9
|
-
/**
|
|
10
|
-
* Sets alias to case expression.
|
|
11
|
-
*/
|
|
12
|
-
as(alias: string): this;
|
|
13
|
-
/**
|
|
14
|
-
* Performs serialization
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} ctx
|
|
17
|
-
* @return {string}
|
|
18
|
-
* @override
|
|
19
|
-
*/
|
|
20
|
-
_serialize(ctx: SerializeContext): string;
|
|
21
|
-
protected __defaultSerialize(ctx: SerializeContext, o: any): string;
|
|
22
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { DataType } from './enums.js';
|
|
2
|
-
import { DeleteQuery } from './query/delete-query.js';
|
|
3
|
-
import { InsertQuery } from './query/insert-query.js';
|
|
4
|
-
import { Query } from './query/query.js';
|
|
5
|
-
import { SelectQuery } from './query/select-query.js';
|
|
6
|
-
import { UnionQuery } from './query/union-query.js';
|
|
7
|
-
import { UpdateQuery } from './query/update-query.js';
|
|
8
|
-
import { Serializable } from './serializable.js';
|
|
9
|
-
import { CaseStatement } from './sql-objects/case-statement.js';
|
|
10
|
-
import { CoalesceStatement } from './sql-objects/coalesce-statement.js';
|
|
11
|
-
import { CountStatement } from './sql-objects/count-statement.js';
|
|
12
|
-
import { FieldExpression } from './sql-objects/field-expression.js';
|
|
13
|
-
import { JoinStatement } from './sql-objects/join-statement.js';
|
|
14
|
-
import { LowerStatement } from './sql-objects/lower-statement.js';
|
|
15
|
-
import { MaxStatement } from './sql-objects/max-statement.js';
|
|
16
|
-
import { MinStatement } from './sql-objects/min-statement.js';
|
|
17
|
-
import { ParamExpression } from './sql-objects/param-expression.js';
|
|
18
|
-
import { RawStatement } from './sql-objects/raw-statement.js';
|
|
19
|
-
import { SequenceGetterStatement } from './sql-objects/sequence-getter-statement.js';
|
|
20
|
-
import { StringAGGStatement } from './sql-objects/string-agg-statement.js';
|
|
21
|
-
import { TableName as TableNameClass, TableNameArgs } from './sql-objects/table-name.js';
|
|
22
|
-
import { UpperStatement } from './sql-objects/upper-statement.js';
|
|
23
|
-
export declare function Raw(text: string): RawStatement;
|
|
24
|
-
export declare function Select(...column: (string | string[] | Serializable)[]): SelectQuery;
|
|
25
|
-
export declare function Insert(tableName: string | RawStatement, input: any): InsertQuery;
|
|
26
|
-
export declare function Update(tableName: string | TableNameClass | RawStatement, input: any): UpdateQuery;
|
|
27
|
-
export declare function Delete(tableName: string | TableNameClass | RawStatement): DeleteQuery;
|
|
28
|
-
export declare function Union(...queries: Query[]): UnionQuery;
|
|
29
|
-
export declare function UnionAll(...queries: Query[]): UnionQuery;
|
|
30
|
-
export declare function TableName(tableName: string | TableNameArgs): TableNameClass;
|
|
31
|
-
export declare function Join(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
32
|
-
export declare function InnerJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
33
|
-
export declare function LeftJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
34
|
-
export declare function LeftOuterJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
35
|
-
export declare function RightJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
36
|
-
export declare function RightOuterJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
37
|
-
export declare function OuterJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
38
|
-
export declare function FullOuterJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
39
|
-
export declare function CrossJoin(table: string | SelectQuery | RawStatement): JoinStatement;
|
|
40
|
-
export declare function Case(): CaseStatement;
|
|
41
|
-
export declare function Coalesce(...expressions: any[]): CoalesceStatement;
|
|
42
|
-
export declare function Lower(expression: any): LowerStatement;
|
|
43
|
-
export declare function Upper(expression: any): UpperStatement;
|
|
44
|
-
export declare function Min(expression: any): MinStatement;
|
|
45
|
-
export declare function Max(expression: any): MaxStatement;
|
|
46
|
-
export declare function StringAGG(field: any): StringAGGStatement;
|
|
47
|
-
export declare function Count(): CountStatement;
|
|
48
|
-
export declare function SequenceNext(expression: string): SequenceGetterStatement;
|
|
49
|
-
export declare function SequenceCurr(expression: string): SequenceGetterStatement;
|
|
50
|
-
export declare function Param(name: string, dataType?: DataType, isArray?: boolean): ParamExpression;
|
|
51
|
-
export declare function Param(args: {
|
|
52
|
-
name: string;
|
|
53
|
-
dataType?: DataType;
|
|
54
|
-
isArray?: boolean;
|
|
55
|
-
}): ParamExpression;
|
|
56
|
-
export declare function Field(name: string, dataType?: DataType, isArray?: boolean): FieldExpression;
|
|
57
|
-
export declare function Field(args: {
|
|
58
|
-
name: string;
|
|
59
|
-
dataType?: DataType;
|
|
60
|
-
isArray?: boolean;
|
|
61
|
-
}): FieldExpression;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { JoinType } from './enums.js';
|
|
2
|
-
import { DeleteQuery } from './query/delete-query.js';
|
|
3
|
-
import { InsertQuery } from './query/insert-query.js';
|
|
4
|
-
import { SelectQuery } from './query/select-query.js';
|
|
5
|
-
import { UnionQuery } from './query/union-query.js';
|
|
6
|
-
import { UpdateQuery } from './query/update-query.js';
|
|
7
|
-
import { CaseStatement } from './sql-objects/case-statement.js';
|
|
8
|
-
import { CoalesceStatement } from './sql-objects/coalesce-statement.js';
|
|
9
|
-
import { CountStatement } from './sql-objects/count-statement.js';
|
|
10
|
-
import { FieldExpression } from './sql-objects/field-expression.js';
|
|
11
|
-
import { JoinStatement } from './sql-objects/join-statement.js';
|
|
12
|
-
import { LowerStatement } from './sql-objects/lower-statement.js';
|
|
13
|
-
import { MaxStatement } from './sql-objects/max-statement.js';
|
|
14
|
-
import { MinStatement } from './sql-objects/min-statement.js';
|
|
15
|
-
import { ParamExpression } from './sql-objects/param-expression.js';
|
|
16
|
-
import { RawStatement } from './sql-objects/raw-statement.js';
|
|
17
|
-
import { SequenceGetterStatement } from './sql-objects/sequence-getter-statement.js';
|
|
18
|
-
import { StringAGGStatement } from './sql-objects/string-agg-statement.js';
|
|
19
|
-
import { TableName as TableNameClass, } from './sql-objects/table-name.js';
|
|
20
|
-
import { UpperStatement } from './sql-objects/upper-statement.js';
|
|
21
|
-
export function Raw(text) {
|
|
22
|
-
return new RawStatement(text);
|
|
23
|
-
}
|
|
24
|
-
export function Select(...column) {
|
|
25
|
-
return new SelectQuery(...column);
|
|
26
|
-
}
|
|
27
|
-
export function Insert(tableName, input) {
|
|
28
|
-
return new InsertQuery(tableName, input);
|
|
29
|
-
}
|
|
30
|
-
export function Update(tableName, input) {
|
|
31
|
-
return new UpdateQuery(tableName, input);
|
|
32
|
-
}
|
|
33
|
-
export function Delete(tableName) {
|
|
34
|
-
return new DeleteQuery(tableName);
|
|
35
|
-
}
|
|
36
|
-
export function Union(...queries) {
|
|
37
|
-
return new UnionQuery(queries);
|
|
38
|
-
}
|
|
39
|
-
export function UnionAll(...queries) {
|
|
40
|
-
return new UnionQuery(queries, 'all');
|
|
41
|
-
}
|
|
42
|
-
export function TableName(tableName) {
|
|
43
|
-
return new TableNameClass(tableName);
|
|
44
|
-
}
|
|
45
|
-
export function Join(table) {
|
|
46
|
-
return new JoinStatement(JoinType.INNER, table);
|
|
47
|
-
}
|
|
48
|
-
export function InnerJoin(table) {
|
|
49
|
-
return new JoinStatement(JoinType.INNER, table);
|
|
50
|
-
}
|
|
51
|
-
export function LeftJoin(table) {
|
|
52
|
-
return new JoinStatement(JoinType.LEFT, table);
|
|
53
|
-
}
|
|
54
|
-
export function LeftOuterJoin(table) {
|
|
55
|
-
return new JoinStatement(JoinType.LEFT_OUTER, table);
|
|
56
|
-
}
|
|
57
|
-
export function RightJoin(table) {
|
|
58
|
-
return new JoinStatement(JoinType.RIGHT, table);
|
|
59
|
-
}
|
|
60
|
-
export function RightOuterJoin(table) {
|
|
61
|
-
return new JoinStatement(JoinType.RIGHT_OUTER, table);
|
|
62
|
-
}
|
|
63
|
-
export function OuterJoin(table) {
|
|
64
|
-
return new JoinStatement(JoinType.OUTER, table);
|
|
65
|
-
}
|
|
66
|
-
export function FullOuterJoin(table) {
|
|
67
|
-
return new JoinStatement(JoinType.FULL_OUTER, table);
|
|
68
|
-
}
|
|
69
|
-
export function CrossJoin(table) {
|
|
70
|
-
return new JoinStatement(JoinType.CROSS, table);
|
|
71
|
-
}
|
|
72
|
-
export function Case() {
|
|
73
|
-
return new CaseStatement();
|
|
74
|
-
}
|
|
75
|
-
export function Coalesce(...expressions) {
|
|
76
|
-
return new CoalesceStatement(...expressions);
|
|
77
|
-
}
|
|
78
|
-
export function Lower(expression) {
|
|
79
|
-
return new LowerStatement(expression);
|
|
80
|
-
}
|
|
81
|
-
export function Upper(expression) {
|
|
82
|
-
return new UpperStatement(expression);
|
|
83
|
-
}
|
|
84
|
-
export function Min(expression) {
|
|
85
|
-
return new MinStatement(expression);
|
|
86
|
-
}
|
|
87
|
-
export function Max(expression) {
|
|
88
|
-
return new MaxStatement(expression);
|
|
89
|
-
}
|
|
90
|
-
export function StringAGG(field) {
|
|
91
|
-
return new StringAGGStatement(field);
|
|
92
|
-
}
|
|
93
|
-
export function Count() {
|
|
94
|
-
return new CountStatement();
|
|
95
|
-
}
|
|
96
|
-
export function SequenceNext(expression) {
|
|
97
|
-
return new SequenceGetterStatement(expression, true);
|
|
98
|
-
}
|
|
99
|
-
export function SequenceCurr(expression) {
|
|
100
|
-
return new SequenceGetterStatement(expression, false);
|
|
101
|
-
}
|
|
102
|
-
export function Param(arg0, arg1, arg2) {
|
|
103
|
-
if (typeof arg0 === 'object')
|
|
104
|
-
return new ParamExpression(arg0);
|
|
105
|
-
return new ParamExpression({
|
|
106
|
-
name: arg0,
|
|
107
|
-
dataType: arg1,
|
|
108
|
-
isArray: arg2,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export function Field(arg0, arg1, arg2) {
|
|
112
|
-
if (typeof arg0 === 'object')
|
|
113
|
-
return new FieldExpression(arg0);
|
|
114
|
-
return new FieldExpression(arg0, arg1, arg2);
|
|
115
|
-
}
|
package/typeguards.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { DeleteQuery } from './query/delete-query.js';
|
|
2
|
-
import type { InsertQuery } from './query/insert-query.js';
|
|
3
|
-
import type { Query } from './query/query.js';
|
|
4
|
-
import type { SelectQuery } from './query/select-query.js';
|
|
5
|
-
import type { UpdateQuery } from './query/update-query.js';
|
|
6
|
-
import type { Serializable } from './serializable.js';
|
|
7
|
-
import type { CaseStatement } from './sql-objects/case-statement.js';
|
|
8
|
-
import type { CountStatement } from './sql-objects/count-statement.js';
|
|
9
|
-
import type { FieldExpression } from './sql-objects/field-expression.js';
|
|
10
|
-
import type { GroupColumn } from './sql-objects/group-column.js';
|
|
11
|
-
import type { JoinStatement } from './sql-objects/join-statement.js';
|
|
12
|
-
import type { CompOperator } from './sql-objects/operators/comp-operator.js';
|
|
13
|
-
import type { LogicalOperator } from './sql-objects/operators/logical-operator.js';
|
|
14
|
-
import type { OrderColumn } from './sql-objects/order-column.js';
|
|
15
|
-
import type { ParamExpression } from './sql-objects/param-expression.js';
|
|
16
|
-
import type { RawStatement } from './sql-objects/raw-statement.js';
|
|
17
|
-
import type { ReturningColumn } from './sql-objects/returning-column.js';
|
|
18
|
-
import type { TableName } from './sql-objects/table-name.js';
|
|
19
|
-
export declare function isSerializable(value: any): value is Serializable;
|
|
20
|
-
export declare function isQuery(value: any): value is Query;
|
|
21
|
-
export declare function isRawStatement(value: any): value is RawStatement;
|
|
22
|
-
export declare function isSelectQuery(value: any): value is SelectQuery;
|
|
23
|
-
export declare function isInsertQuery(value: any): value is InsertQuery;
|
|
24
|
-
export declare function isIUpdateQuery(value: any): value is UpdateQuery;
|
|
25
|
-
export declare function isDeleteQuery(value: any): value is DeleteQuery;
|
|
26
|
-
export declare function isJoinStatement(value: any): value is JoinStatement;
|
|
27
|
-
export declare function isCaseStatement(value: any): value is CaseStatement;
|
|
28
|
-
export declare function isCountStatement(value: any): value is CountStatement;
|
|
29
|
-
export declare function isParamExpression(value: any): value is ParamExpression;
|
|
30
|
-
export declare function isLogicalOperator(value: any): value is LogicalOperator;
|
|
31
|
-
export declare function isCompOperator(value: any): value is CompOperator;
|
|
32
|
-
export declare function isNotOperator(value: any): value is CompOperator;
|
|
33
|
-
export declare function isSelectColumn(value: any): value is FieldExpression;
|
|
34
|
-
export declare function isOrderColumn(value: any): value is OrderColumn;
|
|
35
|
-
export declare function isGroupColumn(value: any): value is GroupColumn;
|
|
36
|
-
export declare function isReturningColumn(value: any): value is ReturningColumn;
|
|
37
|
-
export declare function isTableName(value: any): value is TableName;
|