30 lines
497 B
Go
Raw Normal View History

package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// User holds the schema definition for the User entity.
type User struct {
ent.Schema
}
// Fields of the User.
func (User) Fields() []ent.Field {
return []ent.Field{
field.String("name").
Default("John doe"),
2024-02-14 12:39:10 +01:00
field.Enum("role").
Values("admin", "user", "visitor"),
}
}
// Edges of the User.
func (User) Edges() []ent.Edge {
return []ent.Edge{
edge.To("teams", Team.Type),
}
}