MCPcopy
hub / github.com/pocketbase/pocketbase / NewRecord

Function NewRecord

core/record_model.go:539–561  ·  view source on GitHub ↗

------------------------------------------------------------------- NewRecord initializes a new empty Record model.

(collection *Collection)

Source from the content-addressed store, hash-verified

537
538// NewRecord initializes a new empty Record model.
539func NewRecord(collection *Collection) *Record {
540 record := &Record{
541 collection: collection,
542 data: store.New[string, any](nil),
543 customVisibility: store.New[string, bool](nil),
544 originalData: make(map[string]any, len(collection.Fields)),
545 }
546
547 // initialize default field values
548 var fieldName string
549 for _, field := range collection.Fields {
550 fieldName = field.GetName()
551
552 if fieldName == FieldNameId {
553 continue
554 }
555
556 value, _ := field.PrepareValue(record, nil)
557 record.originalData[fieldName] = value
558 }
559
560 return record
561}
562
563// Collection returns the Collection model associated with the current Record model.
564//

Calls 2

GetNameMethod · 0.65
PrepareValueMethod · 0.65

Used in the wild real call sites across dependent graphs

searching dependent graphs…