remove redundancy in models BeforeInsert hook
This commit is contained in:
parent
c3271d7dcf
commit
2dc0f02d1c
2 changed files with 2 additions and 8 deletions
|
|
@ -25,11 +25,8 @@ func (p *Profile) BeforeInsert(db orm.DB) error {
|
|||
|
||||
// BeforeUpdate hook executed before database update operation.
|
||||
func (p *Profile) BeforeUpdate(db orm.DB) error {
|
||||
if err := p.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
p.UpdatedAt = time.Now()
|
||||
return nil
|
||||
return p.Validate()
|
||||
}
|
||||
|
||||
// Validate validates Profile struct and returns validation errors.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue