owncast/models/event.go
Gabe Kangas b80ccc4966
WIP
2024-03-25 09:04:05 -07:00

21 lines
434 B
Go

package models
import (
"time"
"github.com/teris-io/shortid"
)
// Event is any kind of event. A type is required to be specified.
type Event struct {
Timestamp time.Time `json:"timestamp"`
Type EventType `json:"type,omitempty"`
ID string `json:"id"`
}
// SetDefaults will set default properties of all inbound events.
func (e *Event) SetDefaults() {
e.ID = shortid.MustGenerate()
e.Timestamp = time.Now()
}