UNPKG

memory-orm

Version:
80 lines (79 loc) 1.92 kB
import { List } from './list' import { Cache, DEPLOY, CLASS, SCHEMA, SCOPE, DEFAULT_RULE_TYPE, QUERY_WITH_SCOPE, ID, NameBase, PathCmd, SortCmd, OrderCmd, RelationCmd, } from './type' import { Set } from './set' import { Map } from './map' import { Query } from './query' export declare class Rule<A extends DEFAULT_RULE_TYPE> { $name: NameBase state: Cache all: QUERY_WITH_SCOPE<A> model: CLASS<A[0]> list: CLASS<List<A>> set: CLASS<Set<A>> map: CLASS<Map<A>> constructor( base: string, { model, list, set, map, scope, scope_without_cache, schema, deploy, }?: { model?: CLASS<A[0]> list?: CLASS<List<A>> set?: CLASS<Set<A>> map?: CLASS<Map<A>> scope?: SCOPE<A> scope_without_cache?: SCOPE<A> schema?: SCHEMA<A> deploy?: DEPLOY<A[0]> } ) schema(cb: SCHEMA<A>): this key_by( keys?: | string | string[] | { (): string } ): void deploy(cb: DEPLOY<A[0]>): void depend_on(parent: any): void scope_without_cache(cb: SCOPE<A>): void scope(cb: SCOPE<A>): void property(type: any, o: any): void default_scope(scope: (all: Query<A>) => Query<A>): void shuffle(): void sort(...sort: SortCmd): void order(keys: string | string[], order: OrderCmd): void relation_to_one(key: string, target: string, ik: ID, else_id?: ID): void relation_to_many(key: string, target: string, ik: ID, cmd: string, qk: ID): void relation_tree(key: string, ik: ID): void relation_graph(key: string, ik: string): void use_cache(key: string, val: any): void path(keys: string[], option?: PathCmd): void belongs_to(to: string, option?: RelationCmd): void habtm(to: any, option?: RelationCmd): void has_many(to: any, option?: RelationCmd): void tree(option?: RelationCmd): void graph(option?: RelationCmd): boolean }