PostScan implements the [dbx.PostScanner] interface. It essentially refreshes/updates the current Record original state as if the model was fetched from the databases for the first time. Or in other words, it means that m.Original().FieldsData() will have the same values as m.Record().FieldsData()
()
| 581 | // Or in other words, it means that m.Original().FieldsData() will have |
| 582 | // the same values as m.Record().FieldsData(). |
| 583 | func (m *Record) PostScan() error { |
| 584 | if m.Id == "" { |
| 585 | return errors.New("missing record primary key") |
| 586 | } |
| 587 | |
| 588 | if err := m.BaseModel.PostScan(); err != nil { |
| 589 | return err |
| 590 | } |
| 591 | |
| 592 | m.originalData = m.FieldsData() |
| 593 | |
| 594 | return nil |
| 595 | } |
| 596 | |
| 597 | // HookTags returns the hook tags associated with the current record. |
| 598 | func (m *Record) HookTags() []string { |