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).
()
| 616 | // If record was created using NewRecord() the original will be always |
| 617 | // a blank record (until PostScan() is invoked). |
| 618 | func (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 |