package calendar import ( "time" "github.com/rs/xid" "github.com/rs/zerolog" "gorm.io/gorm" ) var l zerolog.Logger type Calendar struct { ID string `gorm:"primaryKey"` Events []Event CreatedAt time.Time UpdatedAt time.Time } func (c *Calendar) BeforeCreate(tx *gorm.DB) (err error) { if c.ID == "" { c.ID = xid.New().String() } return }