Interface: EntityBuilder<T, O>
Fluent API for configuring an entity metadata model.
Type Parameters
Type Parameter | Default type | Description |
---|---|---|
T extends object | - | The entity builder type. |
O extends object | any | The entity instance type. |
Methods
concurrency()
concurrency(
concurrency
: {version
:NumberKeys
<UnwrapProperties
<T
>>; }):EntityBuilder
<T
,any
>
Configures the concurrency control property of the entity.
Parameters
Parameter | Type | Description |
---|---|---|
concurrency | object | The version property of the entity. |
concurrency.version | NumberKeys <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
Parameter | Type | Description |
---|---|---|
condition | (entity : UnwrapProperties <T >) => boolean | The condition function. |
name ? | string | The 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
: readonlyPartial
<O
>[]):EntityBuilder
<T
,any
>
Configures the initial seed data for the entity.
Parameters
Parameter | Type | Description |
---|---|---|
...data | readonly 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 keyofT
[]):EntityBuilder
<T
,any
>
Configures the key of the entity.
Parameters
Parameter | Type | Description |
---|---|---|
...key | readonly 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
: keyofT
| readonly keyofT
[],options
?:ForeignKeyOptions
):EntityBuilder
<T
,any
>
Configures a foreign key reference to another entity.
Type Parameters
Type Parameter | Description |
---|---|
R extends object | The type of the referenced entity. |
Parameters
Parameter | Type | Description |
---|---|---|
references | string | Newable <R > | EntityModel <R , any > | The referenced entity class, model or name. |
properties | keyof T | readonly keyof T [] | The referencing properties in the current entity. |
options ? | ForeignKeyOptions | Options 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 Parameter | Description |
---|---|
R extends object | The type of the referenced entity. |
Parameters
Parameter | Type | Description |
---|---|---|
references | string | Newable <R > | EntityModel <R , any > | The referenced entity class, model or name. |
options ? | ForeignKeyOptions | Options 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
?: keyofT
| readonly keyofT
[] |ForeignKeyOptions
,options
?:ForeignKeyOptions
):EntityBuilder
<T
,any
>
Type Parameters
Type Parameter |
---|
R extends object |
Parameters
Parameter | Type |
---|---|
references | string | 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.