Skip to content

ModelStatic

ModelStatic<TInstance, TFields, TOptions> = TInstance

Defined in: define/table/types/model.ts:137

Represents the static side of a model class (the class itself). This includes the constructor, static properties like _tableName and _fields, and static methods like create and the overloaded select.

TInstance extends ModelInstance<InferShapeFromFields<TFields>>

The type of a model instance.

TFields extends Record<string, FieldDefinition<unknown>>

The field definitions for the model.

TOptions extends TableDefineOptions<TFields>

The table definition options.

new ModelStatic(data): TInstance

Defined in: define/table/types/model.ts:143

Represents the static side of a model class (the class itself). This includes the constructor, static properties like _tableName and _fields, and static methods like create and the overloaded select.

InferShapeFromFields<TFields>

TInstance

create<T>(this, db, data): Promise<InstanceType<T>>

Defined in: define/table/types/model.ts:153

T extends ModelStatic<TInstance, TFields, TOptions>

T

Surreal

CreateData<TFields>

Promise<InstanceType<T>>


delete<T>(this, db, id): Promise<void>

Defined in: define/table/types/model.ts:219

T extends ModelStatic<TInstance, TFields, TOptions>

T

Surreal

RecordId

Promise<void>


getTableName(): string

Defined in: define/table/types/model.ts:152

string


merge<T>(this, db, id, data): Promise<InstanceType<T>>

Defined in: define/table/types/model.ts:225

T extends ModelStatic<TInstance, TFields, TOptions>

T

Surreal

RecordId

Partial<InferShapeFromFields<TFields>>

Promise<InstanceType<T>>


select<QueryOptions>(this, db, options): Promise<Record<string, unknown>[]>

Defined in: define/table/types/model.ts:162

QueryOptions extends SelectQueryOptions<InferShapeFromFields<TFields>>

ModelStatic<TInstance, TFields, TOptions>

Surreal

QueryOptions & object

Promise<Record<string, unknown>[]>

select<QueryOptions>(this, db, options): Promise<undefined | Partial<InferShapeFromFields<TFields>>>

Defined in: define/table/types/model.ts:171

QueryOptions extends SelectQueryOptions<InferShapeFromFields<TFields>>

ModelStatic<TInstance, TFields, TOptions>

Surreal

QueryOptions & object

Promise<undefined | Partial<InferShapeFromFields<TFields>>>

select<QueryOptions>(this, db, options): Promise<Partial<InferShapeFromFields<TFields>>[]>

Defined in: define/table/types/model.ts:180

QueryOptions extends SelectQueryOptions<InferShapeFromFields<TFields>>

ModelStatic<TInstance, TFields, TOptions>

Surreal

QueryOptions & object

Promise<Partial<InferShapeFromFields<TFields>>[]>

select<QueryOptions>(this, db, options): Promise<undefined | TInstance>

Defined in: define/table/types/model.ts:189

QueryOptions extends SelectQueryOptions<InferShapeFromFields<TFields>>

ModelStatic<TInstance, TFields, TOptions>

Surreal

QueryOptions & object

Promise<undefined | TInstance>

select<QueryOptions>(this, db, options): Promise<TInstance[]>

Defined in: define/table/types/model.ts:198

QueryOptions extends SelectQueryOptions<InferShapeFromFields<TFields>>

ModelStatic<TInstance, TFields, TOptions>

Surreal

QueryOptions & object

Promise<TInstance[]>

select(this, db): Promise<TInstance[]>

Defined in: define/table/types/model.ts:207

ModelStatic<TInstance, TFields, TOptions>

Surreal

Promise<TInstance[]>


update<T>(this, db, id, data): Promise<InstanceType<T>>

Defined in: define/table/types/model.ts:212

T extends ModelStatic<TInstance, TFields, TOptions>

T

Surreal

RecordId

Partial<InferShapeFromFields<TFields>>

Promise<InstanceType<T>>