Basic support for lazy loaded relations
This commit is contained in:
@@ -5,7 +5,7 @@ import {Statement} from './Statement.ts'
|
||||
import {Update} from './type/Update.ts'
|
||||
import {Insert} from './type/Insert.ts'
|
||||
import {Delete} from './type/Delete.ts'
|
||||
import {Truncate} from "./type/Truncate.ts";
|
||||
import {Truncate} from './type/Truncate.ts'
|
||||
|
||||
export function raw(value: string) {
|
||||
return new RawValue(value)
|
||||
|
||||
@@ -5,6 +5,7 @@ import {apply_filter_to_where, QueryFilter} from '../../model/filter.ts'
|
||||
import {Scope} from '../Scope.ts'
|
||||
import {FunctionScope, ScopeFunction} from '../scope/FunctionScope.ts'
|
||||
import {make} from '../../../../di/src/global.ts'
|
||||
import RawValue from '../RawValue.ts'
|
||||
|
||||
export class WhereBuilder {
|
||||
protected _wheres: WhereStatement[] = []
|
||||
@@ -68,6 +69,16 @@ export class WhereBuilder {
|
||||
return this
|
||||
}
|
||||
|
||||
whereRaw(field: string, operator: SQLWhereOperator, operand: string) {
|
||||
this._createWhere('AND', field, operator, new RawValue(operand))
|
||||
return this
|
||||
}
|
||||
|
||||
orWhereRaw(field: string, operator: SQLWhereOperator, operand: string) {
|
||||
this._createWhere('OR', field, operator, new RawValue(operand))
|
||||
return this
|
||||
}
|
||||
|
||||
whereIn(field: string, values: EscapedValue) {
|
||||
this._wheres.push({
|
||||
field,
|
||||
|
||||
@@ -10,7 +10,7 @@ export type WherePreOperator = 'AND' | 'OR' | 'AND NOT' | 'OR NOT'
|
||||
export type WhereClause = { field: string, operator: SQLWhereOperator, operand: string, preop: WherePreOperator }
|
||||
export type WhereGroup = { items: WhereStatement[], preop: WherePreOperator }
|
||||
export type WhereStatement = WhereClause | WhereGroup
|
||||
export type SQLWhereOperator = WhereOperator | 'IN' | 'NOT IN' | 'LIKE' | 'BETWEEN' | 'NOT BETWEEN'
|
||||
export type SQLWhereOperator = WhereOperator | 'IN' | 'NOT IN' | 'LIKE' | 'BETWEEN' | 'NOT BETWEEN' | 'IS' | 'IS NOT'
|
||||
export type OrderDirection = 'ASC' | 'DESC'
|
||||
export type OrderStatement = { direction: OrderDirection, field: string }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user