MCPcopy
hub / github.com/pocketbase/pocketbase / normalizeValue

Method normalizeValue

core/field_relation.go:169–180  ·  view source on GitHub ↗
(raw any)

Source from the content-addressed store, hash-verified

167}
168
169func (f *RelationField) normalizeValue(raw any) any {
170 val := list.ToUniqueStringSlice(raw)
171
172 if !f.IsMultiple() {
173 if len(val) > 0 {
174 return val[len(val)-1] // the last selected
175 }
176 return ""
177 }
178
179 return val
180}
181
182// DriverValue implements the [DriverValuer] interface.
183func (f *RelationField) DriverValue(record *Record) (driver.Value, error) {

Callers 2

PrepareValueMethod · 0.95
setValueMethod · 0.95

Calls 2

IsMultipleMethod · 0.95
ToUniqueStringSliceFunction · 0.92

Tested by

no test coverage detected