Add TreeModel and HasSubtree implementation

This commit is contained in:
2022-08-20 16:21:06 -05:00
parent 3d836afa59
commit f63891ef99
22 changed files with 380 additions and 108 deletions

View File

@@ -222,17 +222,45 @@ export abstract class AbstractBuilder<T> extends AppClass {
return this
}
/** Apply a WHERE ... IS NULL constraint to the query. */
whereNull(field: string): this {
return this.whereRawValue(field, 'IS', 'NULL')
}
/** Apply a WHERE ... IS NOT NULL constraint to the query. */
whereNotNull(field: string): this {
return this.whereRawValue(field, 'IS NOT', 'NULL')
}
/**
* Apply a new WHERE constraint to the query, without escaping `operand`. Prefer `where()`.
* @param field
* @param operator
* @param operand
*/
whereRaw(field: string, operator: ConstraintOperator, operand: string): this {
whereRawValue(field: string, operator: ConstraintOperator, operand: string): this {
this.createConstraint('AND', field, operator, raw(operand))
return this
}
/**
* Add raw SQL as a constraint to the query.
* @param clause
*/
whereRaw(clause: string|QuerySafeValue): this {
if ( !(clause instanceof QuerySafeValue) ) {
clause = raw(clause)
}
this.constraints.push(raw(clause))
return this
}
/** Apply an impossible constraint to the query, causing it to match 0 rows. */
whereMatchNone(): this {
return this.whereRaw('1=0')
}
/**
* Apply a new WHERE NOT constraint to the query.
* @param field