Rindle

API index and search · Build metadata

Supporting declarations

packages/client/src/operators.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

PRED

declare const PRED: unique symbol;

Pred

/** A value predicate (an operator applied to a value). `V` is a phantom for type-checking. */
export interface Pred<V> {
    readonly [PRED]: true;
    readonly op: SimpleOp;
    readonly value: LitValue;
    readonly __v?: V;
}

isPred

export declare function isPred(x: unknown): x is Pred<unknown>;

eq

export declare const eq: <V>(v: V) => Pred<V>;

ne

export declare const ne: <V>(v: V) => Pred<V>;

gt

export declare const gt: <V extends number | string>(v: V) => Pred<V>;

ge

export declare const ge: <V extends number | string>(v: V) => Pred<V>;

lt

export declare const lt: <V extends number | string>(v: V) => Pred<V>;

le

export declare const le: <V extends number | string>(v: V) => Pred<V>;

like

export declare const like: (pattern: string) => Pred<string>;

notLike

export declare const notLike: (pattern: string) => Pred<string>;

ilike

export declare const ilike: (pattern: string) => Pred<string>;

notIlike

export declare const notIlike: (pattern: string) => Pred<string>;

inList

export declare const inList: <V>(values: V[]) => Pred<V>;

notInList

export declare const notInList: <V>(values: V[]) => Pred<V>;

is

export declare const is: <V>(v: V) => Pred<V>;

isNot

export declare const isNot: <V>(v: V) => Pred<V>;

isNull

/** `IS NULL` — a field-agnostic null check. `V` is inferred from the field's expected `Arg<V>`
 *  (e.g. `where.signedAt(isNull())`), so it fits a column of any type without a cast. */
export declare const isNull: <V = never>() => Pred<V>;

isNotNull

/** `IS NOT NULL` — the negation of {@link isNull}; `V` is inferred from the field, like {@link isNull}. */
export declare const isNotNull: <V = never>() => Pred<V>;

Arg

/** A field argument: its typed predicate, or a bare value (bare = `eq` sugar). */
export type Arg<V> = Pred<V> | V;

Cond

/** A condition over row `R`. The runtime value is the wire {@link Condition}; `R` is a
 *  phantom brand so a condition for one table can't be `.where()`d onto another. */
export type Cond<R> = Condition & {
    readonly __row?: R;
};

fieldCondition

/** Build a `simple` condition from a field name + (predicate | bare value). */
export declare function fieldCondition(field: string, arg: unknown): Condition;

and

/** All children must hold. */
export declare function and<R>(...conds: Cond<R>[]): Cond<R>;

or

/** At least one child must hold. */
export declare function or<R>(...conds: Cond<R>[]): Cond<R>;