Skip to content

egon-orm-workspace / egon-orm / Col

Interface: Col<T> ​

Defined in: core/src/query/expr.ts:1359

A column of a binding: u.email. Query bindings hold one per field, made once per schema and alias.

Example ​

ts
const email = new Col<string>("u", meta(User).fieldsByName.get("email"));

Extends ​

Type Parameters ​

T ​

T

Properties ​

~expr ​

ts
readonly "~expr": object;

Defined in: core/src/query/expr.ts:567

Type information only; there is no such property at run time. params is a function type so that P is contravariant: see SomeParams.

params ​

ts
readonly params: (params) => void;
Parameters ​
params ​

P

Returns ​

void

type ​

ts
readonly type: T;

Inherited from ​

Expr.~expr


binding ​

ts
readonly binding: string;

Defined in: core/src/query/expr.ts:1361

The alias of the binding.


fieldMeta ​

ts
readonly fieldMeta: FieldMeta;

Defined in: core/src/query/expr.ts:1363

The field the column belongs to. (Not field, which is the method that reads a field of an embed.)


lists ​

ts
readonly lists: readonly number[];

Defined in: core/src/query/expr.ts:577

The lengths of the lists of node, in canonical order.

Inherited from ​

Expr.lists


named ​

ts
readonly named: readonly NamedParamNode[];

Defined in: core/src/query/expr.ts:579

The named parameters of node, in canonical order (a name may repeat).

Inherited from ​

Expr.named


node ​

ts
readonly node: ExprNode;

Defined in: core/src/query/expr.ts:569

The AST node.

Inherited from ​

Expr.node


params ​

ts
readonly params: readonly unknown[];

Defined in: core/src/query/expr.ts:575

The bound values of node, in canonical order.

Inherited from ​

Expr.params


redact ​

ts
readonly redact: boolean;

Defined in: core/src/query/expr.ts:573

Whether a value compared with or assigned to this expression is hidden from logs.

Inherited from ​

Expr.redact


shape ​

ts
readonly shape: number;

Defined in: core/src/query/expr.ts:581

The structural hash of node (shapeOf(node)).

Inherited from ​

Expr.shape


type ​

ts
readonly type: AnyFieldType | undefined;

Defined in: core/src/query/expr.ts:571

The type the value is loaded with when it is selected, when one is known.

Inherited from ​

Expr.type

Methods ​

add() ​

ts
add<S, O, X>(this, other): Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:991

+. The result is read as the wider of the two operands' types (integer < bigint < decimal < float; a plain value takes this operand's type) and is nullable when either side is. The same holds for sub, mul and div; mod keeps this operand's type.

Type Parameters ​

S ​

S extends number | bigint | null

O ​

O extends number | bigint | Expr<S | null, never>

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Calculable<X, O>

Returns ​

Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.loginCount.add(1);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.add


and() ​

ts
and<O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:841

AND. Chained calls make one flat a AND b AND c.

Type Parameters ​

O ​

O extends BoolOperand

Parameters ​

this ​

Expr<boolean | null, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.age.gte(18).and(u.role.eq("admin"));

Throws ​

QueryError when given anything but a boolean or a boolean expression.

Inherited from ​

Expr.and


append() ​

ts
append<S, O>(this, element): Expr<NonNullable<S>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1173

array_append(array, element): the array with element added at the end. Appending to a null array gives a one-element array. For bulk updates: .set(({ p }) => ({ tagList: p.tagList.append("ts") })).

Type Parameters ​

S ​

S extends readonly unknown[] | null

O ​

O extends | { } | Expr<ElementOf<S> | null, never> | null

Parameters ​

this ​

Expr<S, never>

element ​

O & Compatible<NoParams, O>

Returns ​

Expr<NonNullable<S>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.append("ts");

Throws ​

QueryError when given undefined.

Inherited from ​

Expr.append


as() ​

ts
as<U>(): Expr<U, NoParams>;

Defined in: core/src/query/expr.ts:1299

Gives the expression another TypeScript type. No SQL: it is an assertion, so it is only as right as you make it.

Type Parameters ​

U ​

U

Returns ​

Expr<U, NoParams>

Example ​

ts
fragment`lower(${u.email})`.as<string>();

Inherited from ​

Expr.as


asc() ​

ts
asc(): OrderExpr<NoParams>;

Defined in: core/src/query/expr.ts:1313

Ascending order (ASC).

Returns ​

OrderExpr<NoParams>

Example ​

ts
u.name.asc().nullsLast();

Inherited from ​

Expr.asc


between() ​

ts
between<S, L, H>(
   this, 
   low, 
   high
): Expr<boolean, Simplify<NoParams & Simplify<ParamsOf<L> & ParamsOf<H>>>>;

Defined in: core/src/query/expr.ts:724

BETWEEN low AND high, both ends included.

Type Parameters ​

S ​

S extends AnyExpr

L ​

L extends | { } | Expr<T | null, never>

H ​

H extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

low ​

L & ([ValueOf<L>] extends [null] ? object : unknown) & Compatible<NoParams, L> & Comparable<S, L>

high ​

H & ([ValueOf<H>] extends [null] ? object : unknown) & Compatible<Simplify<NoParams & ParamsOf<L>>, H> & Comparable<S, H>

Returns ​

Expr<boolean, Simplify<NoParams & Simplify<ParamsOf<L> & ParamsOf<H>>>>

Example ​

ts
u.age.between(18, 65);

Throws ​

QueryError when either end is null or undefined.

Inherited from ​

Expr.between


cast() ​

ts
cast<S, U, F>(this, type): Expr<CastResult<S, U>, NoParams>;

Defined in: core/src/query/expr.ts:1274

CAST(x AS type), where type is a field type: t.integer(), t.string(). The result is loaded with that type. A nullable operand gives a nullable result.

Type Parameters ​

S ​

S

U ​

U

F ​

F extends FieldFlags

Parameters ​

this ​

Expr<S, never>

type ​

FieldBuilder<U, F>

Returns ​

Expr<CastResult<S, U>, NoParams>

Example ​

ts
u.age.cast(t.string());
sum(p.views).cast(t.bigint());

Throws ​

QueryError when type is not a field type.

Inherited from ​

Expr.cast


concat() ​

ts
concat<S, A>(this, ...parts): Expr<string | NullOf<S> | NullOf<ValueOf<A[number]>>, Simplify<NoParams & ParamsOfAll<A>>>;

Defined in: core/src/query/expr.ts:940

||: text joined together. null anywhere makes the result null.

Type Parameters ​

S ​

S extends string | null

A ​

A extends readonly TextOperand[]

Parameters ​

this ​

Expr<S, never>

parts ​

...A & CompatibleParams<NoParams, ParamsOfAll<A>>

Returns ​

Expr<string | NullOf<S> | NullOf<ValueOf<A[number]>>, Simplify<NoParams & ParamsOfAll<A>>>

Example ​

ts
u.firstName.concat(" ", u.lastName);

Throws ​

QueryError when a part is null or undefined, or no part is given.

Inherited from ​

Expr.concat


containedBy() ​

ts
containedBy<O>(this, values): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1110

<@: every element of the array is in values.

Type Parameters ​

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

Expr<readonly unknown[] | null, never>

values ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.containedBy(["ts", "sql"]);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.containedBy


contains() ​

ts
contains<O>(this, values): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1093

@>: the array holds every element of values.

Type Parameters ​

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

Expr<readonly unknown[] | null, never>

values ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.contains(["ts"]);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.contains


desc() ​

ts
desc(): OrderExpr<NoParams>;

Defined in: core/src/query/expr.ts:1332

Descending order (DESC).

Returns ​

OrderExpr<NoParams>

Example ​

ts
u.createdAt.desc().nullsLast();

Inherited from ​

Expr.desc


div() ​

ts
div<S, O, X>(this, other): Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1043

/. Two integers divide as integers, truncating towards zero, on every database (on MySQL, whose / gives a decimal, it is written DIV).

Type Parameters ​

S ​

S extends number | bigint | null

O ​

O extends number | bigint | Expr<S | null, never>

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Calculable<X, O>

Returns ​

Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.views.div(2);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.div


eq() ​

ts
eq<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:622

=. A value becomes a bound parameter with this expression's type. null is refused: use isNull.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.email.eq("ada@example.com");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.eq


field() ​

ts
field<S, K>(this, name): Expr<EmbedFieldValue<S, K>, NoParams>;

Defined in: core/src/query/expr.ts:1253

A field of an embedded row, typed from the embedded schema: u.address.field("city") is an Expr<string>. It reads the field's JSON key (#>>, cast to the field's type where that is not text; #> for a nested embed or JSON field, so that field can be chained). The key is a bound parameter. A row stored without the key gives null.

Type Parameters ​

S ​

S

K ​

K extends string

Parameters ​

this ​

EmbedExpr<S>

name ​

K & { [K in string | number | symbol]-?: NonNullable<S>[K] extends (args: never[]) => unknown ? never : NonNullable<NonNullable<S>[K]> extends readonly unknown[] | Uint8Array<ArrayBufferLike> ? never : K }[keyof NonNullable<S>] & string

Returns ​

Expr<EmbedFieldValue<S, K>, NoParams>

Example ​

ts
from(User, "u").where(({ u }) => u.address.field("city").eq("Oslo"));

Throws ​

QueryError when the expression is not of an embed of one row, or the embedded schema has no stored field name.

Inherited from ​

Expr.field


gt() ​

ts
gt<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:656

>.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.age.gt(17);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.gt


gte() ​

ts
gte<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:673

>=.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.age.gte(18);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.gte


has() ​

ts
has<S, O>(this, element): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1144

element = ANY(array): the array holds element.

Type Parameters ​

S ​

S extends readonly unknown[] | null

O ​

O extends | { } | Expr<ElementOf<S> | null, never>

Parameters ​

this ​

Expr<S, never>

element ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.has("ts");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.has


ilike() ​

ts
ilike<O>(this, pattern): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:923

ILIKE: LIKE ignoring case.

Type Parameters ​

O ​

O extends TextOperand

Parameters ​

this ​

Expr<string | null, never>

pattern ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.name.ilike("%ann%");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.ilike


in() ​

ts
in<S, O>(this, values): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:754

= ANY($1) (or IN (…)): one bound list, a column or expression of array type, or a query. An empty list is false, without a parameter.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends InOperand<T>

Parameters ​

this ​

S

values ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O extends readonly E[] ? E : O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.role.in(["admin", "member"]);

Throws ​

QueryError when the list holds null or undefined, or the argument is not a list, an expression or a query.

Inherited from ​

Expr.in


isDistinctFrom() ​

ts
isDistinctFrom<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:812

IS DISTINCT FROM: inequality that treats null as a value, so null is accepted.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never> | null

Parameters ​

this ​

S

other ​

O & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.name.isDistinctFrom(u.email);

Throws ​

QueryError when given undefined.

Inherited from ​

Expr.isDistinctFrom


isNotNull() ​

ts
isNotNull(): Expr<boolean, NoParams>;

Defined in: core/src/query/expr.ts:798

IS NOT NULL.

Returns ​

Expr<boolean, NoParams>

Example ​

ts
u.name.isNotNull();

Inherited from ​

Expr.isNotNull


isNull() ​

ts
isNull(): Expr<boolean, NoParams>;

Defined in: core/src/query/expr.ts:786

IS NULL.

Returns ​

Expr<boolean, NoParams>

Example ​

ts
u.name.isNull();

Inherited from ​

Expr.isNull


like() ​

ts
like<O>(this, pattern): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:889

LIKE: % matches any run of characters, _ one character.

Type Parameters ​

O ​

O extends TextOperand

Parameters ​

this ​

Expr<string | null, never>

pattern ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.email.like("%@example.com");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.like


lower() ​

ts
lower<S>(this): Expr<string | NullOf<S>, NoParams>;

Defined in: core/src/query/expr.ts:961

lower(x).

Type Parameters ​

S ​

S extends string | null

Parameters ​

this ​

Expr<S, never>

Returns ​

Expr<string | NullOf<S>, NoParams>

Example ​

ts
u.email.lower().eq("ada@example.com");

Inherited from ​

Expr.lower


lt() ​

ts
lt<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:690

<.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.createdAt.lt(new Date());

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.lt


lte() ​

ts
lte<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:707

<=.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.age.lte(65);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.lte


mod() ​

ts
mod<S, O, X>(this, other): Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1060

%: the remainder.

Type Parameters ​

S ​

S extends number | bigint | null

O ​

O extends number | bigint | Expr<S | null, never>

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Calculable<X, O>

Returns ​

Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.id.mod(2).eq(0);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.mod


mul() ​

ts
mul<S, O, X>(this, other): Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1025

*.

Type Parameters ​

S ​

S extends number | bigint | null

O ​

O extends number | bigint | Expr<S | null, never>

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Calculable<X, O>

Returns ​

Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.views.mul(2);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.mul


neg() ​

ts
neg<S, X>(this): Expr<Numeric<S> | NullOf<S>, NoParams>;

Defined in: core/src/query/expr.ts:1075

Unary -.

Type Parameters ​

S ​

S extends number | bigint | null

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never> & Negatable<X>

Returns ​

Expr<Numeric<S> | NullOf<S>, NoParams>

Example ​

ts
p.views.neg();

Inherited from ​

Expr.neg


neq() ​

ts
neq<S, O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:639

<>.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

S

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.role.neq("admin");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.neq


not() ​

ts
not(this): Expr<boolean, NoParams>;

Defined in: core/src/query/expr.ts:873

NOT.

Parameters ​

this ​

Expr<boolean | null, never>

Returns ​

Expr<boolean, NoParams>

Example ​

ts
p.published.not();

Inherited from ​

Expr.not


notIn() ​

ts
notIn<S, O>(this, values): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:771

The negation of in. An empty list is true.

Type Parameters ​

S ​

S extends AnyExpr

O ​

O extends InOperand<T>

Parameters ​

this ​

S

values ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Comparable<S, O extends readonly E[] ? E : O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.role.notIn(["admin"]);

Throws ​

QueryError when the list holds null or undefined, or the argument is not a list, an expression or a query.

Inherited from ​

Expr.notIn


notLike() ​

ts
notLike<O>(this, pattern): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:906

NOT LIKE.

Type Parameters ​

O ​

O extends TextOperand

Parameters ​

this ​

Expr<string | null, never>

pattern ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.email.notLike("%@example.com");

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.notLike


or() ​

ts
or<O>(this, other): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:858

OR. Chained calls make one flat a OR b OR c.

Type Parameters ​

O ​

O extends BoolOperand

Parameters ​

this ​

Expr<boolean | null, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
u.role.eq("admin").or(u.age.gte(65));

Throws ​

QueryError when given anything but a boolean or a boolean expression.

Inherited from ​

Expr.or


overlaps() ​

ts
overlaps<O>(this, values): Expr<boolean, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1127

&&: the arrays share an element.

Type Parameters ​

O ​

O extends | { } | Expr<T | null, never>

Parameters ​

this ​

Expr<readonly unknown[] | null, never>

values ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O>

Returns ​

Expr<boolean, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.overlaps(["ts", "sql"]);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.overlaps


path() ​

ts
path(this, ...keys): Expr<unknown, NoParams>;

Defined in: core/src/query/expr.ts:1220

#>: the JSON value at a path of keys (and array indexes). Each key is a bound parameter. The result is JSON of unknown shape: give it a type with cast or as.

Parameters ​

this ​

JsonExpr<T>

keys ​

...readonly [JsonKey, JsonKey]

Returns ​

Expr<unknown, NoParams>

Example ​

ts
u.settings.path("theme");
u.settings.path("limits", 0).cast(t.integer());

Throws ​

QueryError when no key is given, a key is not a string or a whole number, or the expression has a known type that is not JSON.

Inherited from ​

Expr.path


pathText() ​

ts
pathText(this, ...keys): Expr<string | null, NoParams>;

Defined in: core/src/query/expr.ts:1235

#>>: the value at a path of keys, as text (null when there is nothing there).

Parameters ​

this ​

JsonExpr<T>

keys ​

...readonly [JsonKey, JsonKey]

Returns ​

Expr<string | null, NoParams>

Example ​

ts
u.settings.pathText("theme").eq("dark");

Throws ​

QueryError when no key is given, a key is not a string or a whole number, or the expression has a known type that is not JSON.

Inherited from ​

Expr.pathText


remove() ​

ts
remove<S, O>(this, element): Expr<S, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1194

array_remove(array, element): the array without any element equal to element.

Type Parameters ​

S ​

S extends readonly unknown[] | null

O ​

O extends | { } | Expr<ElementOf<S> | null, never> | null

Parameters ​

this ​

Expr<S, never>

element ​

O & Compatible<NoParams, O>

Returns ​

Expr<S, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.tagList.remove("draft");

Throws ​

QueryError when given undefined.

Inherited from ​

Expr.remove


sub() ​

ts
sub<S, O, X>(this, other): Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>;

Defined in: core/src/query/expr.ts:1008

-.

Type Parameters ​

S ​

S extends number | bigint | null

O ​

O extends number | bigint | Expr<S | null, never>

X ​

X extends Expr<S, never>

Parameters ​

this ​

X & Expr<S, never>

other ​

O & ([ValueOf<O>] extends [null] ? object : unknown) & Compatible<NoParams, O> & Calculable<X, O>

Returns ​

Expr<Numeric<S> | NullOf<S> | NullOf<ValueOf<O>>, Simplify<NoParams & ParamsOf<O>>>

Example ​

ts
p.views.sub(1);

Throws ​

QueryError when given null or undefined.

Inherited from ​

Expr.sub


upper() ​

ts
upper<S>(this): Expr<string | NullOf<S>, NoParams>;

Defined in: core/src/query/expr.ts:973

upper(x).

Type Parameters ​

S ​

S extends string | null

Parameters ​

this ​

Expr<S, never>

Returns ​

Expr<string | NullOf<S>, NoParams>

Example ​

ts
u.email.upper();

Inherited from ​

Expr.upper