• Decorator that maps the given property to a database column of the specified FieldType.

    Example

    class MyModel extends Model<MyModel> {
    // Maps the 'name' VARCHAR column in the database to this property
    @Field(FieldType.Varchar)
    public name!: string

    // Maps the 'first_name' VARCHAR column in the database to this property
    @Field(FieldType.Varchar, 'first_name')
    public firstName!: string
    }

    Parameters

    • type: FieldType
    • Optional databaseKey: string

    Returns PropertyDecorator