UNPKG

refql

Version:

A Node.js and Deno library for composing and running SQL queries.

42 lines (41 loc) 2.2 kB
import Prop from "."; import Operation from "../RQLTag/Operation"; import RQLNode from "../RQLTag/RQLNode"; import { SQLTag } from "../SQLTag"; import { Simplify, TagFunctionVariable } from "../common/types"; import PropType from "./PropType"; interface SQLProp<As extends string = any, Output = any, Params = any, IsOmitted extends boolean = any, HasOp extends boolean = any> extends RQLNode, PropType<As> { params: Params; col: SQLTag<Params>; output: Output; isOmitted: IsOmitted; arrayOf(): SQLProp<As, Output[], Params, IsOmitted, HasOp>; nullable(): SQLProp<As, Output | null, Params, IsOmitted, HasOp>; eq<Params2 = {}>(run: TagFunctionVariable<Simplify<Params & Params2>, Output> | Output): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; notEq: this["eq"]; isNull<Params2 = {}>(): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; notIsNull: this["isNull"]; like<Params2 = {}>(run: TagFunctionVariable<Simplify<Params & Params2>, string> | string): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; notLike: this["like"]; iLike: this["like"]; notILike: this["like"]; in<Params2 = {}>(run: TagFunctionVariable<Simplify<Params & Params2>, Output[]> | Output[]): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; notIn: this["in"]; gt<Params2 = {}>(run: TagFunctionVariable<Simplify<Params & Params2>, Output> | Output): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; gte: this["gt"]; lt: this["gt"]; lte: this["gt"]; asc(): SQLProp<As, Output, Params, IsOmitted, true>; desc: this["asc"]; operations: Operation<Params>[]; hasOp: HasOp; omit(): SQLProp<As, Output, Params, true, HasOp>; or<Params2 = {}>(prop: Prop | SQLProp<any, any, Params2> | SQLTag<Params2>): SQLProp<As, Output, Simplify<Params & Params2>, IsOmitted, true>; and: this["or"]; interpret: () => SQLTag; } declare function SQLProp<As extends string, Params = any>(as: As, col: SQLTag<Params>): SQLProp<As, any, Params, false, false>; declare namespace SQLProp { var isSQLProp: (x: any) => x is SQLProp; } export default SQLProp;