app/calendar/event.go

29 lines
365 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 Event struct {
ID string `gorm:"primaryKey"`
Start time.Time
End time.Time
CalendarID string
EventGroupID string
CreatedAt time.Time
UpdatedAt time.Time
}
func (e *Event) BeforeCreate(tx *gorm.DB) (err error) {
if e.ID == "" {
e.ID = xid.New().String()
}
return
}