30 lines
480 B
Go
30 lines
480 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// Project holds the schema definition for the Project entity.
|
|
type Project struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Project.
|
|
func (Project) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("name").
|
|
Unique(),
|
|
}
|
|
}
|
|
|
|
// Edges of the Project.
|
|
func (Project) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.From("team", Team.Type).
|
|
Ref("projects").
|
|
Unique(),
|
|
}
|
|
}
|