Compare commits
3 commits
6b121937f7
...
67b10d949a
Author | SHA1 | Date | |
---|---|---|---|
67b10d949a | |||
a6d368eb58 | |||
e446270591 |
4 changed files with 21 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dblang",
|
||||
"version": "1.0.0",
|
||||
"version": "0.6.2",
|
||||
"description": "",
|
||||
"main": "dist/db.js",
|
||||
"types": "dist/db.d.ts",
|
||||
|
|
|
@ -238,6 +238,7 @@ BooleanModifier:
|
|||
- `le(v1, v2, ...)`
|
||||
- `not(v1)`
|
||||
- `like(v1, v2)`
|
||||
- `exists(s)`
|
||||
|
||||
NumberModifier:
|
||||
- `plus(v1, v2, ...)`
|
||||
|
@ -248,7 +249,7 @@ NumberModifier:
|
|||
StringModifier:
|
||||
- `concat(v1, v2, ...)`
|
||||
|
||||
(v\* = string, number, boolean, null, Modifier, Aggregation, select Query, Attribute)
|
||||
(v\* = string, number, boolean, null, Modifier, Aggregation, select Query, Attribute; s = selectQuery)
|
||||
|
||||
#### Joins
|
||||
|
||||
|
|
|
@ -751,6 +751,22 @@ export class Handler {
|
|||
}
|
||||
return builder;
|
||||
},
|
||||
exists: (handler: Handler, a: allModifierInput[]):QueryBuilder =>{
|
||||
let e = a[0];
|
||||
if (e instanceof Attribute || e instanceof AttributeAlias) return new QueryBuilder([{ data: "exists (" + e.getString(handler) + ")" }])
|
||||
if (e instanceof Modifier || e instanceof selectQuery || e instanceof Aggregation) {
|
||||
const builder = new QueryBuilder();
|
||||
builder.addCode("exists (");
|
||||
builder.append(e.serialize(handler));
|
||||
builder.addCode(")");
|
||||
return builder;
|
||||
}
|
||||
return new QueryBuilder([
|
||||
{ data: "exists (" },
|
||||
{ inject: true, data: e },
|
||||
{ data: ")" }
|
||||
]);
|
||||
},
|
||||
concat: (handler: Handler, a: allModifierInput[]): QueryBuilder => {
|
||||
const builder = new QueryBuilder();
|
||||
builder.addCode("CONCAT(");
|
||||
|
|
|
@ -20,6 +20,8 @@ export const not = (arg: allModifierInput) => new BooleanModifier("not", [arg]);
|
|||
export const like = (a: allModifierInput, b: allModifierInput) => new BooleanModifier("like", [a, b]);
|
||||
export const regexp = (a: allModifierInput, b: allModifierInput) => new BooleanModifier("regexp", [a, b]);
|
||||
|
||||
export const exists = (q: selectQuery) => new BooleanModifier("exists", [q]);
|
||||
|
||||
export const concat = (...args: allModifierInput[]) => new StringModifier("concat", args);
|
||||
|
||||
//aggregations
|
||||
|
|
Loading…
Reference in a new issue