MCPcopy
hub / github.com/pocketbase/pocketbase / RemoveByName

Method RemoveByName

core/fields_list.go:99–107  ·  view source on GitHub ↗

RemoveByName removes a single field by its name. This method does nothing if field with the specified name doesn't exist.

(fieldName string)

Source from the content-addressed store, hash-verified

97//
98// This method does nothing if field with the specified name doesn't exist.
99func (l *FieldsList) RemoveByName(fieldName string) {
100 fields := *l
101 for i, field := range fields {
102 if field.GetName() == fieldName {
103 *l = append(fields[:i], fields[i+1:]...)
104 return
105 }
106 }
107}
108
109// Add adds one or more fields to the current list.
110//

Callers 4

TestFieldsListRemoveFunction · 0.95
TestCollectionValidateFunction · 0.80
TestCollectionSaveModelFunction · 0.80

Calls 1

GetNameMethod · 0.65

Tested by 4

TestFieldsListRemoveFunction · 0.76
TestCollectionValidateFunction · 0.64
TestCollectionSaveModelFunction · 0.64