static/jsvm/interfaces/core.FieldsList.html
FieldsList defines a Collection slice of fields.
addaddAtaddMarshaledJSONaddMarshaledJSONAtasMapclonefieldNamesgetByIdgetByNamemarshalJSONremoveByIdremoveByNamescanstringunmarshalJSONvalue
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).
Rest ...fields: core.Field[]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.
Rest ...fields: core.Field[]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.Copy
Example:
l.AddMarshaledJSON([]byte{`{"type":"text", name: "test"}`}) l.AddMarshaledJSON([]byte{`[{"type":"text", name: "test1"}, {"type":"text", name: "test2"}]`})Copy
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.
FieldNames returns a slice with the name of all list fields.
GetById returns a single field by its id.
GetByName returns a single field by its name.
MarshalJSON implements the [json.Marshaler] interface.
RemoveById removes a single field by its id.
This method does nothing if field with the specified id doesn't exist.
RemoveByName removes a single field by its name.
This method does nothing if field with the specified name doesn't exist.
Scan implements [sql.Scanner] interface to scan the provided value into the current FieldsList instance.
String returns the string representation of the current list.
UnmarshalJSON implements [json.Unmarshaler] and loads the provided json data into the current FieldsList.
Value implements the [driver.Valuer] interface.
OSLightDark
Generated using TypeDoc