Options
All
  • Public
  • Public/Protected
  • All
Menu

Base Field implementation used by many of the basic field types.

Type parameters

  • V

    Type for the value of the field.

Hierarchy

Implements

Index

Constructors

Properties

alias?: string

Table attribute to map this Model property to.

default?: V | DefaultFunction<V>

Value or function to get value from to use when the Model property is empty.

name?: string

Model name of the field, set by init function in Model or Field constructor.

Methods

  • Get the default value to use in toTable if no value it set.

    Parameters

    • name: string

      Model property name associated with field (passed into toTable).

    • modelData: ModelData

      Data from the model that to reference for default.

    • context: TableContext

      Current context this method is being called in.

    Returns undefined | V

    Default value to use.

  • init(name: string, model: Model): void
  • Initialize the field with the field name from the Model's schema and the model.

    Parameters

    • name: string

      Name of the model attribute this field is set on.

    • model: Model

      Model this field is associated with.

    Returns void

  • tableName(): string
  • Name of table attribute. Used in Condition based Field methods.

    Returns string

  • Method called after calling into the table object to read and write to the table. This method will convert the table data into model data.

    Parameters

    • name: string

      Name of the model attribute this field is associated with (generally same as init name argument).

    • tableData: Table.AttributeValuesMap

      Data from the table that needs to be mapped to the model data.

    • modelData: ModelData

      Data object for the model that this method will append to.

    • context: ModelContext

      Current context this method is being called in.

    Returns void

  • Method called before calling into the table object to read and write to the table. This method will convert the model data into table data and append read or write conditions.

    Parameters

    • name: string

      Name of the model attribute this field is associated with (generally same as init name argument).

    • modelData: ModelData

      Data from the model that needs to be mapped to the table data.

    • tableData: Table.AttributeValuesMap

      Data object for the table that this method will append to.

    • context: TableContext

      Current context this method is being called in.

    Returns void

  • Method called before calling into the table object to update the table. This method will convert the model data into table data and append read or write conditions.

    Note: Several Fields will just call toTable from toTableUpdate if they don't support any special update syntax.

    Parameters

    • name: string

      Name of the model attribute this field is associated with (generally same as init name argument)

    • modelData: ModelUpdate

      Data from the model that needs to be mapped to the table data.

    • tableData: ResolverMap

      Data object for the table that this method will append to.

    • context: TableContext

      Current context this method is being called in.

    Returns void

Generated using TypeDoc