memory-orm
Version:
client side ORM + map reduce
80 lines (79 loc) • 1.69 kB
TypeScript
import {
Memory,
Filter,
OrderCmd,
ReduceDefault,
ID,
DIC,
QUERY_ARGS,
SortCmd,
DEFAULT_RULE_TYPE,
} from './type'
import { Finder } from './finder'
import { List } from './list'
export declare class Query<A extends DEFAULT_RULE_TYPE> {
_is_uniq: boolean
_all_ids: string[]
_reduce?: A[1] & ReduceDefault<A>
_step: number
_filters: Filter[]
_finder: Finder<A>
_group: any
_cache: {
[idx: string]: any
}
$sort: {
[path: string]: OrderCmd
}
$partition: any
$page_by: any
$memory: Memory
all: Query<A>
get reduce(): A[1] & ReduceDefault<A>
get list(): List<A>
get hash(): DIC<A[0]>
get memory(): Memory
get ids(): string[]
static build<A extends DEFAULT_RULE_TYPE>({
$sort,
$memory,
}: {
$sort: any
$memory: any
}): Query<A>
constructor(base: any, tap: (this: Query<A>) => void)
_copy({
all,
_all_ids,
_group,
_is_uniq,
_filters,
$sort,
$partition,
$page_by,
}: {
all: any
_all_ids: any
_group: any
_is_uniq: any
_filters: any
$sort: any
$partition: any
$page_by: any
}): void
in(req: QUERY_ARGS): Query<A>
where(req: (o: A[0]) => any): Query<A>
where(req: QUERY_ARGS): Query<A>
partition(...ary: string[]): Query<A>
distinct(b?: boolean): Query<A>
distance(key: any, order: any, point: any): Query<A>
search(text: any, target?: string): Query<A>
shuffle(): Query<A>
order(keys: string | string[], order: OrderCmd): Query<A>
sort(...sort: SortCmd): Query<A>
page(page_by: number): Query<A>
form(...ids: ID[]): any
find(...ids: ID[]): A[0] | null
finds(ids: ID[]): A[0][]
pluck(...keys: ID[]): List<any>
}