tspace-mysql
Version:
Tspace MySQL is a promise-based ORM for Node.js, designed with modern TypeScript and providing type safety for schema databases.
32 lines (31 loc) • 1.46 kB
TypeScript
import { Join } from './Join';
declare class SqlLike {
private $db;
private $action;
private $values;
private $state;
private $returning?;
select(...selecteds: string[]): this;
distinct(): this;
from(table: string): this;
join(localKey: `${string}.${string}` | ((join: Join) => Join), referenceKey?: `${string}.${string}`): this;
leftJoin(localKey: `${string}.${string}` | ((join: Join) => Join), referenceKey?: `${string}.${string}`): this;
rightJoin(localKey: `${string}.${string}` | ((join: Join) => Join), referenceKey?: `${string}.${string}`): this;
where(column: Record<string, any>, operator?: any, value?: any): this;
orderBy(column: string, order?: 'ASC' | 'asc' | 'DESC' | 'desc'): this;
groupBy(...columns: string[]): this;
offset(n?: number): this;
limit(n?: number): this;
having(condition: string): this;
dd(): this;
delete(table: string): this;
update(table: string): this;
set(values: Record<string, any>): this;
insert(table: string): this;
values(values: Record<string, any> | Record<string, any>[]): this;
returning(returning?: Record<string, any> | null): this;
then<TResult1 = string, TResult2 = never>(onFulfilled: ((value: any[]) => TResult1 | PromiseLike<TResult1>), onRejected: ((reason: any) => TResult2 | PromiseLike<TResult2>)): Promise<TResult1 | TResult2>;
}
declare const sql: () => SqlLike;
export { sql };
export default sql;