crowdsec/pkg/database/ent/schema/event.go
Thibault "bui" Koechlin dbb420f79e
local api (#482)
Co-authored-by: AlteredCoder
Co-authored-by: erenJag
2020-11-30 10:37:17 +01:00

36 lines
636 B
Go

package schema
import (
"time"
"github.com/facebook/ent"
"github.com/facebook/ent/schema/edge"
"github.com/facebook/ent/schema/field"
)
// Event holds the schema definition for the Event entity.
type Event struct {
ent.Schema
}
// Fields of the Event.
func (Event) Fields() []ent.Field {
return []ent.Field{
field.Time("created_at").
Default(time.Now),
field.Time("updated_at").
Default(time.Now),
field.Time("time"),
field.String("serialized").MaxLen(4095),
}
}
// Edges of the Event.
func (Event) Edges() []ent.Edge {
return []ent.Edge{
edge.From("owner", Alert.Type).
Ref("events").
Unique(),
}
}