MCPcopy
hub / github.com/pocketbase/pocketbase / Original

Method Original

core/record_model.go:618–629  ·  view source on GitHub ↗

Original returns a shallow copy of the current record model populated with its ORIGINAL db data state (aka. right after PostScan()) and everything else reset to the defaults. If record was created using NewRecord() the original will be always a blank record (until PostScan() is invoked).

()

Source from the content-addressed store, hash-verified

616// If record was created using NewRecord() the original will be always
617// a blank record (until PostScan() is invoked).
618func (m *Record) Original() *Record {
619 newRecord := NewRecord(m.collection)
620
621 newRecord.originalData = maps.Clone(m.originalData)
622
623 if newRecord.originalData[FieldNameId] != nil {
624 newRecord.lastSavedPK = cast.ToString(newRecord.originalData[FieldNameId])
625 newRecord.Id = newRecord.lastSavedPK
626 }
627
628 return newRecord
629}
630
631// Fresh returns a shallow copy of the current record model populated
632// with its LATEST data state and everything else reset to the defaults

Callers 15

TestRecordPostScanFunction · 0.95
FreshMethod · 0.95
CloneMethod · 0.95
DBExportMethod · 0.95
registerOTPHooksMethod · 0.80
getLatestOldValueMethod · 0.80
getLastKnownValueMethod · 0.80
TestRecordOriginalFunction · 0.80
registerMFAHooksMethod · 0.80

Calls 2

NewRecordFunction · 0.85
CloneMethod · 0.45

Tested by 4

TestRecordPostScanFunction · 0.76
TestRecordOriginalFunction · 0.64