MCPcopy
hub / github.com/pocketbase/pocketbase / ValidateValue

Method ValidateValue

core/field_bool.go:109–120  ·  view source on GitHub ↗

ValidateValue implements [Field.ValidateValue] interface method.

(ctx context.Context, app App, record *Record)

Source from the content-addressed store, hash-verified

107
108// ValidateValue implements [Field.ValidateValue] interface method.
109func (f *BoolField) ValidateValue(ctx context.Context, app App, record *Record) error {
110 v, ok := record.GetRaw(f.Name).(bool)
111 if !ok {
112 return validators.ErrUnsupportedValueType
113 }
114
115 if f.Required {
116 return validation.Required.Validate(v)
117 }
118
119 return nil
120}
121
122// ValidateSettings implements [Field.ValidateSettings] interface method.
123func (f *BoolField) ValidateSettings(ctx context.Context, app App, collection *Collection) error {

Callers

nothing calls this directly

Calls 2

GetRawMethod · 0.80
ValidateMethod · 0.65

Tested by

no test coverage detected