Skip to main content

Class: UpdateSetBuilder<T>

Defined in: src/set/UpdateSetBuilder.ts:19

Fluent builder for specifying property updates in LINQ executeUpdate queries.

Modeled after EF Core's ExecuteUpdate setter pattern, allowing type-safe assignments using string column keys or strongly-typed lambda selectors (e) => e.property.

Example​

await db.users
.where(u => u.status, '=', 'inactive')
.executeUpdate(s => s
.set(u => u.status, 'archived')
.set('retryCount', 0)
);

Type Parameters​

Type ParameterDefault type
Tany

Constructors​

Constructor​

new UpdateSetBuilder<T>(): UpdateSetBuilder<T>

Returns​

UpdateSetBuilder<T>

Methods​

set()​

set<K>(property, value): this

Defined in: src/set/UpdateSetBuilder.ts:29

Assigns a new value to an entity property or column.

Type Parameters​

Type Parameter
K extends string | string & object

Parameters​

ParameterTypeDescription
property((entity) => unknown) | KProperty name key or lambda property selector (e) => e.prop.
valueanyThe value to assign to the column.

Returns​

this

this builder instance for chaining.


increment()​

increment<K>(property, amount?): this

Defined in: src/set/UpdateSetBuilder.ts:40

Increments a numeric column by a specified amount (defaults to 1).

Type Parameters​

Type Parameter
K extends string | string & object

Parameters​

ParameterTypeDefault value
property((entity) => unknown) | Kundefined
amountnumber1

Returns​

this


getData()​

getData(): Record<string, unknown>

Defined in: src/set/UpdateSetBuilder.ts:54

Returns the internal key-value mapping of updated properties.

Returns​

Record<string, unknown>