GORM - CB

1.1 Create

// begin transaction
BeforeSave
BeforeCreate
// save before-associations
// update timestamp `CreatedAt`, `UpdatedAt`
// save self
// reload fields that have default value and its value is blank
// save after-associations
AfterCreate
AfterSave
// commit or rollback transaction

1.2 Update

// begin transaction
BeforeSave
BeforeUpdate
// save before-associations
// update timestamp `UpdatedAt`
// save self
// save after-associations
AfterUpdate
AfterSave
// commit or rollback transaction

1.3 Delete

1.4 Find

2. Example

change during crud

Last updated