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).
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"}]`})
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.
AsMap returns a map with all registered list field. The returned map is indexed with each field name.
Clone creates a deep clone of the current list.
Generated using TypeDoc
FieldsList defines a Collection slice of fields.