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) } }