Skip to content

Commit 41df807

Browse files
committed
feat(ent): set up index for category and difficulty
1 parent 7249759 commit 41df807

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ent/schema/question.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"entgo.io/ent/schema"
77
"entgo.io/ent/schema/edge"
88
"entgo.io/ent/schema/field"
9+
"entgo.io/ent/schema/index"
910
)
1011

1112
type Question struct {
@@ -48,6 +49,13 @@ func (Question) Edges() []ent.Edge {
4849
}
4950
}
5051

52+
func (Question) Indexes() []ent.Index {
53+
return []ent.Index{
54+
index.Fields("category"),
55+
index.Fields("difficulty"),
56+
}
57+
}
58+
5159
func (Question) Annotations() []schema.Annotation {
5260
return []schema.Annotation{
5361
entgql.QueryField().Directives(

0 commit comments

Comments
 (0)