1
1
package schema
2
2
3
3
import (
4
+ "entgo.io/contrib/entgql"
4
5
"entgo.io/ent"
6
+ "entgo.io/ent/schema"
5
7
"entgo.io/ent/schema/edge"
6
8
"entgo.io/ent/schema/field"
7
9
)
@@ -15,17 +17,23 @@ type TargetPair struct {
15
17
func (TargetPair ) Fields () []ent.Field {
16
18
return []ent.Field {
17
19
// The label of the target ex: //foo:bar.
18
- field .String ("label" ).Optional (),
20
+ field .String ("label" ).
21
+ Optional (),
19
22
20
23
// Duration in Milliseconds.
21
24
// Time from target configured message received and processed until target completed message received and processed, calculated on build complete
22
- field .Int64 ("duration_in_ms" ).Optional (),
25
+ field .Int64 ("duration_in_ms" ).
26
+ Optional ().
27
+ Annotations (entgql .OrderField ("DURATION" )),
23
28
24
29
// Overall success of the target (defaults to false).
25
- field .Bool ("success" ).Optional ().Default (false ),
30
+ field .Bool ("success" ).
31
+ Optional ().
32
+ Default (false ),
26
33
27
34
// The target kind if available.
28
- field .String ("target_kind" ).Optional (),
35
+ field .String ("target_kind" ).
36
+ Optional (),
29
37
30
38
// The size of the test, if the target is a test target. Unset otherwise.
31
39
field .Enum ("test_size" ).
@@ -72,3 +80,11 @@ func (TargetPair) Edges() []ent.Edge {
72
80
Unique (),
73
81
}
74
82
}
83
+
84
+ // Annotations of the TargetPair
85
+ func (TargetPair ) Annotations () []schema.Annotation {
86
+ return []schema.Annotation {
87
+ entgql .RelayConnection (),
88
+ entgql .QueryField ("findTargets" ),
89
+ }
90
+ }
0 commit comments