FieldsList model class, usually used to define the Collection.fields.

Hierarchy

Implements

Constructors

Methods

  • Add adds one or more fields to the current list.

    By default this method will try to REPLACE existing fields with the new ones by their id or by their name if the new field doesn't have an explicit id.

    If no matching existing field is found, it will APPEND the field to the end of the list.

    In all cases, if any of the new fields don't have an explicit id it will auto generate a default one for them (the id value doesn't really matter and it is mostly used as a stable identifier in case of a field rename).

    Parameters

    Returns void

  • AddAt is the same as Add but insert/move the fields at the specific position.

    If pos < 0, then this method acts the same as calling Add.

    If pos > FieldsList total items, then the specified fields are inserted/moved at the end of the list.

    Parameters

    Returns void

  • AddMarshaledJSON parses the provided raw json data and adds the found fields into the current list (following the same rule as the Add method).

    The rawJSON argument could be one of:

      - serialized array of field objects
    - single field object.

    Example:

     l.AddMarshaledJSON([]byte{`{"type":"text", name: "test"}`})
    l.AddMarshaledJSON([]byte{`[{"type":"text", name: "test1"}, {"type":"text", name: "test2"}]`})

    Parameters

    • rawJSON: string | number[]

    Returns void

  • AddMarshaledJSONAt is the same as AddMarshaledJSON but insert/move the fields at the specific position.

    If pos < 0, then this method acts the same as calling AddMarshaledJSON.

    If pos > FieldsList total items, then the specified fields are inserted/moved at the end of the list.

    Parameters

    • pos: number
    • rawJSON: string | number[]

    Returns void

  • RemoveById removes a single field by its id.

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

    Parameters

    • fieldId: string

    Returns void

  • RemoveByName removes a single field by its name.

    This method does nothing if field with the specified name doesn't exist.

    Parameters

    • fieldName: string

    Returns void

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

    Parameters

    • value: any

    Returns void

  • UnmarshalJSON implements [json.Unmarshaler] and loads the provided json data into the current FieldsList.

    Parameters

    • data: string | number[]

    Returns void

Generated using TypeDoc