MCPcopy
hub / github.com/pocketbase/pocketbase / DriverValue

Method DriverValue

core/field_select.go:170–182  ·  view source on GitHub ↗

DriverValue implements the [DriverValuer] interface.

(record *Record)

Source from the content-addressed store, hash-verified

168
169// DriverValue implements the [DriverValuer] interface.
170func (f *SelectField) DriverValue(record *Record) (driver.Value, error) {
171 val := list.ToUniqueStringSlice(record.GetRaw(f.Name))
172
173 if !f.IsMultiple() {
174 if len(val) > 0 {
175 return val[len(val)-1], nil // the last selected
176 }
177 return "", nil
178 }
179
180 // serialize as json string array
181 return append(types.JSONArray[string]{}, val...), nil
182}
183
184// ValidateValue implements [Field.ValidateValue] interface method.
185func (f *SelectField) ValidateValue(ctx context.Context, app App, record *Record) error {

Callers

nothing calls this directly

Calls 3

IsMultipleMethod · 0.95
ToUniqueStringSliceFunction · 0.92
GetRawMethod · 0.80

Tested by

no test coverage detected