Skip to main content

Interface: EntityBuilder<T, O>

Fluent API for configuring an entity metadata model.

Type Parameters​

Type ParameterDefault typeDescription
T extends object-The entity builder type.
O extends objectanyThe entity instance type.

Methods​

concurrency()​

concurrency(concurrency: {version: NumberKeys<UnwrapProperties<T>>; }): EntityBuilder<T, any>

Configures the concurrency control property of the entity.

Parameters​

ParameterTypeDescription
concurrencyobjectThe version property of the entity.
concurrency.versionNumberKeys<UnwrapProperties<T>>-

Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:276


condition()​

condition(condition: (entity: UnwrapProperties<T>) => boolean, name?: string): EntityBuilder<T, any>

Configures a condition for the entity. Conditions are predicates that are applied by default to all queries for the entity.

Parameters​

ParameterTypeDescription
condition(entity: UnwrapProperties<T>) => booleanThe condition function.
name?stringThe name of the condition.

Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:268


data()​

data(...data: readonly Partial<O>[]): EntityBuilder<T, any>

Configures the initial seed data for the entity.

Parameters​

ParameterTypeDescription
...datareadonly Partial<O>[]The initial data.

Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:284


key()​

key(...key: readonly keyof T[]): EntityBuilder<T, any>

Configures the key of the entity.

Parameters​

ParameterTypeDescription
...keyreadonly keyof T[]One or more properties to use as the key.

Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:216


references()​

references(references, properties, options)​

references<R>(references: string | Newable<R> | EntityModel<R, any>, properties: keyof T | readonly keyof T[], options?: ForeignKeyOptions): EntityBuilder<T, any>

Configures a foreign key reference to another entity.

Type Parameters​
Type ParameterDescription
R extends objectThe type of the referenced entity.
Parameters​
ParameterTypeDescription
referencesstring | Newable<R> | EntityModel<R, any>The referenced entity class, model or name.
propertieskeyof T | readonly keyof T[]The referencing properties in the current entity.
options?ForeignKeyOptionsOptions controlling the behavior of the foreign key.
Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:227

references(references, options)​

references<R>(references: string | Newable<R> | EntityModel<R, any>, options?: ForeignKeyOptions): EntityBuilder<T, any>

Configures a foreign key reference to another entity.

Type Parameters​
Type ParameterDescription
R extends objectThe type of the referenced entity.
Parameters​
ParameterTypeDescription
referencesstring | Newable<R> | EntityModel<R, any>The referenced entity class, model or name.
options?ForeignKeyOptionsOptions controlling the behavior of the foreign key.
Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:241

references(references, propertiesOrOptions, options)​

references<R>(references: string | Newable<R> | EntityModel<R, any>, propertiesOrOptions?: keyof T | readonly keyof T[] | ForeignKeyOptions, options?: ForeignKeyOptions): EntityBuilder<T, any>

Type Parameters​
Type Parameter
R extends object
Parameters​
ParameterType
referencesstring | Newable<R> | EntityModel<R, any>
propertiesOrOptions?keyof T | readonly keyof T[] | ForeignKeyOptions
options?ForeignKeyOptions
Returns​

EntityBuilder<T, any>

Defined in​

packages/verse-core/src/model/builder.ts:246


table()​

table(name: string): EntityBuilder<T, any>

Configures the table name of the entity.

Parameters​

ParameterTypeDescription
namestringThe table name.

Returns​

EntityBuilder<T, any>

A chainable EntityBuilder instance.

Defined in​

packages/verse-core/src/model/builder.ts:258