manager/ent/schema/alias.go

34 lines
703 B
Go
Raw Permalink Normal View History

2022-04-08 21:23:41 +02:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"time"
)
// Alias holds the schema definition for the Alias entity.
type Alias struct {
ent.Schema
}
// Fields of the Alias.
func (Alias) Fields() []ent.Field {
return []ent.Field{
field.Int64("id"),
field.Time("created").Default(time.Now).Immutable(),
field.Time("modified").Default(time.Now).UpdateDefault(time.Now).Nillable().Optional(),
field.Int64("domain_id").Optional(),
field.Text("goto"),
field.Bool("active"),
}
}
// Edges of the Alias.
func (Alias) Edges() []ent.Edge {
return []ent.Edge{
edge.From("domain", Domain.Type).Ref("aliases").Field("domain_id").Unique(),
}
}