You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
647 B

import {Scope} from '../Scope.ts'
import {WhereBuilder} from '../type/WhereBuilder.ts'
/**
* Base type of functions which provide a query scope.
*/
export type ScopeFunction = (query: WhereBuilder) => WhereBuilder
/**
* Query scope class which builds its clauses by calling an external function.
* @extends Scope
*/
export class FunctionScope extends Scope {
constructor(
/**
* The scope function used to scope the query.
* @type ScopeFunction
*/
protected _fn: ScopeFunction
) {
super()
}
apply(query: WhereBuilder): WhereBuilder {
return this._fn(query)
}
}