MCPcopy
hub / github.com/pocketbase/pocketbase / AddMarshaledJSON

Method AddMarshaledJSON

core/fields_list.go:154–163  ·  view source on GitHub ↗

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", nam

(rawJSON []byte)

Source from the content-addressed store, hash-verified

152// l.AddMarshaledJSON([]byte{`{"type":"text", name: "test"}`})
153// l.AddMarshaledJSON([]byte{`[{"type":"text", name: "test1"}, {"type":"text", name: "test2"}]`})
154func (l *FieldsList) AddMarshaledJSON(rawJSON []byte) error {
155 extractedFields, err := marshaledJSONtoFieldsList(rawJSON)
156 if err != nil {
157 return err
158 }
159
160 l.Add(extractedFields...)
161
162 return nil
163}
164
165// AddMarshaledJSONAt is the same as AddMarshaledJSON but insert/move the fields at the specific position.
166//

Callers 1

Calls 2

AddMethod · 0.95

Tested by 1