25 lines
317 B
Go
25 lines
317 B
Go
|
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
|
||
|
}
|