MCPcopy
hub / github.com/pocketbase/pocketbase / Fresh

Method Fresh

core/record_model.go:634–645  ·  view source on GitHub ↗

Fresh returns a shallow copy of the current record model populated with its LATEST data state and everything else reset to the defaults (aka. no expand, no unknown fields and with default visibility flags).

()

Source from the content-addressed store, hash-verified

632// with its LATEST data state and everything else reset to the defaults
633// (aka. no expand, no unknown fields and with default visibility flags).
634func (m *Record) Fresh() *Record {
635 newRecord := m.Original()
636
637 // note: this will also load the Id field through m.GetRaw
638 var fieldName string
639 for _, field := range m.collection.Fields {
640 fieldName = field.GetName()
641 newRecord.SetRaw(fieldName, m.GetRaw(fieldName))
642 }
643
644 return newRecord
645}
646
647// Clone returns a shallow copy of the current record model with all of
648// its collection and unknown fields data, expand and flags copied.

Callers 5

ReplaceModifiersMethod · 0.95
TestRecordFreshFunction · 0.80
CloneMethod · 0.80
TestEnrichRecordsFunction · 0.80
realtimeBroadcastRecordFunction · 0.80

Calls 4

OriginalMethod · 0.95
GetRawMethod · 0.95
SetRawMethod · 0.80
GetNameMethod · 0.65

Tested by 2

TestRecordFreshFunction · 0.64
TestEnrichRecordsFunction · 0.64