You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want CreateAt and UpdatedAt updated and PropsJSON <=> Props get transformed automatically.
My first thought is that if structable supports Hooks I can write following methods:
// called before Insertfunc (this*Object) BeforeInsert() {
this.CreatedAt=time.Now()
}
// called before Updatefunc (this*Object) BeforeUpdate() {
this.UpdatedAt=time.Now()
}
// called before Insert and Updatefunc (this*Object) BeforeSave() {
_, this.ProsJSON=json.Marshal(&this.Props)
}
// called after Loadfunc (this*Object) AfterLoad() {
json.Unmarshal([]byte(this.PropsJSON), &this.Props)
}
Do you think this is a good idea?
Thanks!
The text was updated successfully, but these errors were encountered:
Do you think hooks fit in structable's design?
For example,
I have a struct
I want CreateAt and UpdatedAt updated and PropsJSON <=> Props get transformed automatically.
My first thought is that if structable supports Hooks I can write following methods:
Do you think this is a good idea?
Thanks!
The text was updated successfully, but these errors were encountered: