gomanager/ent/schema/logentry.go
2023-12-01 23:02:33 +01:00

30 lines
554 B
Go

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// Logentry holds the schema definition for the Logentry entity.
type Logentry struct {
ent.Schema
}
// Fields of the Logentry.
func (Logentry) Fields() []ent.Field {
return []ent.Field{
field.Int("id"),
field.Time("date").Default(time.Now).Immutable(),
field.Text("content"),
}
}
// Edges of the Logentry.
func (Logentry) Edges() []ent.Edge {
return []ent.Edge{
edge.From("project", Project.Type).Ref("logentries").Unique(),
}
}