addconstconst add: <T extends number | null>(a: Expr<T>, b: Operand<number>) => Expr<T>a + b, of numbers.
Typed expressions (commons data 0053-sql-typed): a value of SQL is an Expr<T>, where T is the TypeScript type of what it gives, nullable where it may be null. The operators take expressions of one type and give expressions, so that a comparison of a number with a text, or a sum of a name, does not compile. An expression is data (a tree); compile.ts writes it for a dialect.
addconstconst add: <T extends number | null>(a: Expr<T>, b: Operand<number>) => Expr<T>a + b, of numbers.
andconstconst and: (...parts: readonly Expr<boolean>[]) => Expr<boolean>Every condition holds; with none it is true.
ascconstconst asc: (e: Expr<unknown>) => OrderAscending.
avgconstno test imports itconst avg: (a: Expr<number | null>) => Expr<number | null>avg(a): null where there is no row.
betweenconstconst between: <T>(a: Expr<T>, low: Operand<NonNullable<T>>, high: Operand<NonNullable<T>>) => Expr<boolean>a BETWEEN low AND high.
chooseconstconst choose: <T>(whens: readonly (readonly [Expr<boolean>, Operand<T>])[], otherwise: Operand<T>) => Expr<T>CASE WHEN ... THEN ... ELSE ... END.
coalesceconstconst coalesce: <T>(a: Expr<T>, fallback: Operand<NonNullable<T>>) => Expr<NonNullable<T>>The first that is not null; the last is a value that is, so the result is not null.
concatconstno test imports itconst concat: <T extends string | null>(a: Expr<T>, b: Operand<string>) => Expr<T>The texts joined (||).
countconstconst count: () => Expr<number>count(*).
countDistinctconstno test imports itconst countDistinct: (a: Expr<unknown>) => Expr<number>count(DISTINCT a).
countOfconstconst countOf: (a: Expr<unknown>) => Expr<number>count(a): the rows where it is not null.
descconstconst desc: (e: Expr<unknown>) => OrderDescending.
eqconstconst eq: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a = b; a null is never equal (use isNull).
gtconstconst gt: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a > b.
gteconstno test imports itconst gte: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a >= b.
ilikeconstconst ilike: (a: Expr<string | null>, pattern: Operand<string>) => Expr<boolean>A case-blind LIKE, written the same on every dialect (lower(a) LIKE lower(pattern)).
inListconstconst inList: <T>(a: Expr<T>, values: readonly Operand<NonNullable<T>>[]) => Expr<boolean>a IN (...); an empty list is false.
isNotNullconstconst isNotNull: (a: Expr<unknown>) => Expr<boolean>a IS NOT NULL.
isNullconstconst isNull: (a: Expr<unknown>) => Expr<boolean>a IS NULL.
likeconstconst like: (a: Expr<string | null>, pattern: Operand<string>) => Expr<boolean>a LIKE pattern.
litconstconst lit: <T extends string | number | boolean | Date | null | readonly number[] | object>(value: T) => Expr<T>A value as an expression.
lowerconstconst lower: <T extends string | null>(a: Expr<T>) => Expr<T>lower(a).
ltconstno test imports itconst lt: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a < b.
lteconstconst lte: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a <= b.
maxconstconst max: <T>(a: Expr<T>) => Expr<T | null>max(a): null where there is no row.
minconstno test imports itconst min: <T>(a: Expr<T>) => Expr<T | null>min(a): null where there is no row.
mulconstno test imports itconst mul: <T extends number | null>(a: Expr<T>, b: Operand<number>) => Expr<T>a * b, of numbers.
neconstconst ne: <T>(a: Expr<T>, b: Operand<NonNullable<T>>) => Expr<boolean>a <> b.
notconstconst not: (a: Expr<boolean>) => Expr<boolean>NOT a.
notInListconstno test imports itconst notInList: <T>(a: Expr<T>, values: readonly Operand<NonNullable<T>>[]) => Expr<boolean>a NOT IN (...); an empty list is true.
Operandtypeno test imports ittype Operand<T> = Expr<T> | T;What an operator takes where an expression of type T is wanted: the expression, or a plain value of the type.
orconstconst or: (...parts: readonly Expr<boolean>[]) => Expr<boolean>Some condition holds; with none it is false.
Orderinterfaceno test imports itinterface OrderOne term of an ORDER BY.
| Member | Type | What it is |
|---|---|---|
e | Expr<unknown> | |
dir | "ASC" | "DESC" |
subconstno test imports itconst sub: <T extends number | null>(a: Expr<T>, b: Operand<number>) => Expr<T>a - b, of numbers.
sumconstconst sum: (a: Expr<number | null>) => Expr<number | null>sum(a): null where there is no row.
upperconstno test imports itconst upper: <T extends string | null>(a: Expr<T>) => Expr<T>upper(a).