Skip to main content

Field

@quik/database


@quik/database / Field

Function: Field()

Field<TModel>(table, field): string

Defined in: database/src/repository/Field.ts:24

Builds a fully-qualified table.column field name, with the field name checked against TModel's actual fields at compile time. Intended for .where()/.having()/.select()/.groupBy()/.orderBy() calls on QJoinQueryBuilder, where field names are otherwise plain, unchecked strings.

The table name itself is not verified against TModel — pass the same table name you used in .join().

Type Parameters

TModel

TModel extends QModel

Parameters

table

string

Table name to qualify the field with.

field

QModelFieldName<TModel>

Field name on TModel.

Returns

string

Example

Field<ProjectTeamMember>('ProjectTeamMember', 'userId'); // 'ProjectTeamMember.userId', field name is type-checked
Field<ProjectTeamMember>('ProjectTeamMember', 'usrId'); // compile error — no such field