app/calendar/event_group.go

25 lines
317 B
Go
Raw Normal View History

2021-12-21 11:44:27 +00:00
package calendar
import (
"time"
"github.com/rs/xid"
"gorm.io/gorm"
)
type EventGroup struct {
ID string `gorm:"primaryKey"`
Events []Event
CreatedAt time.Time
UpdatedAt time.Time
}
func (eg *EventGroup) BeforeCreate(tx *gorm.DB) (err error) {
if eg.ID == "" {
eg.ID = xid.New().String()
}
return
}