UNPKG

@useorbis/db-sdk

Version:

Orbis' Typescript SDK for building open-data experiences.

64 lines (63 loc) 1.82 kB
import { OrbisDB } from "../../index.js"; import { StatementHistory } from "./historyProvider.js"; import { OrderByParams } from "./sqlbuild/index.js"; export declare class SelectStatement<T = Record<string, any>> extends StatementHistory { #private; constructor(orbis: OrbisDB); static buildQueryFromJson(jsonQuery: Record<string, any>): { query: string; params: any[]; }; raw(query: string, params?: Array<any>): this; from(tableName: string): this; column(column: string | any): this; columns(...columns: Array<string | any>): this; deselectColumn(column: string): this; clearColumns(): this; limit(limit: number): this; offset(offset: number): this; context(context: string): this; contexts(...contexts: Array<string>): this; where(whereClause: Record<string, any>): this; orderBy(...params: Array<OrderByParams>): this; get jsonQuery(): { $raw: { query: string; params: any[]; }; $table?: undefined; $columns?: undefined; $where?: undefined; $orderBy?: undefined; $limit?: undefined; $offset?: undefined; } | { $table: string; $columns: string[]; $where: Record<string, any>; $orderBy: OrderByParams[] | undefined; $limit: number | undefined; $offset: number | undefined; $raw?: undefined; }; build(): { query: string; params: any[]; }; get runs(): ({ [k: string]: any; success: boolean; timestamp: number; query: any; } & ({ result: any; } | { error: any; }) & { details?: any; })[]; run(env?: string): Promise<{ columns: Array<string>; rows: T[]; }>; }