Schema model class, usually used to define the Collection.schema field.

Hierarchy

Implements

Constructors

Methods

  • AddField registers the provided newField to the current schema.

    If field with newField.Id already exist, the existing field is replaced with the new one.

    Otherwise the new field is appended to the other schema fields.

    Parameters

    Returns void

  • MarshalJSON implements the [json.Marshaler] interface.

    Returns string | number[]

  • RemoveField removes a single schema field by its id.

    This method does nothing if field with id doesn't exist.

    Parameters

    • id: string

    Returns void

  • Scan implements [sql.Scanner] interface to scan the provided value into the current Schema instance.

    Parameters

    • value: any

    Returns void

  • UnmarshalJSON implements the [json.Unmarshaler] interface.

    On success, all schema field options are auto initialized.

    Parameters

    • data: string | number[]

    Returns void

  • Validate makes Schema validatable by implementing [validation.Validatable] interface.

    Internally calls each individual field's validator and additionally checks for invalid renamed fields and field name duplications.

    Returns void

Generated using TypeDoc