-
Notifications
You must be signed in to change notification settings - Fork 419
/
types.go
112 lines (95 loc) · 3.43 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016 Datadog, Inc.
package types
import (
"github.com/DataDog/dd-trace-go/v2/internal/appsec/dyngo"
"github.com/DataDog/dd-trace-go/v2/internal/appsec/trace"
)
type (
RequestOperation struct {
dyngo.Operation
trace.TagSetter
trace.SecurityEventsHolder
}
// RequestOperationArgs describes arguments passed to a GraphQL request.
RequestOperationArgs struct {
RawQuery string // The raw, not-yet-parsed GraphQL query
OperationName string // The user-provided operation name for the query
Variables map[string]any // The user-provided variables object for this request
}
RequestOperationRes struct {
// Data is the data returned from processing the GraphQL operation.
Data any
// Error is the error returned by processing the GraphQL Operation, if any.
Error error
}
)
// Finish the GraphQL query operation, along with the given results, and emit a finish event up in
// the operation stack.
func (q *RequestOperation) Finish(res RequestOperationRes) {
dyngo.FinishOperation(q, res)
}
func (RequestOperationArgs) IsArgOf(*RequestOperation) {}
func (RequestOperationRes) IsResultOf(*RequestOperation) {}
type (
ExecutionOperation struct {
dyngo.Operation
trace.TagSetter
trace.SecurityEventsHolder
}
// ExecutionOperationArgs describes arguments passed to a GraphQL query operation.
ExecutionOperationArgs struct {
// Variables is the user-provided variables object for the query.
Variables map[string]any
// Query is the query that is being executed.
Query string
// OperationName is the user-provided operation name for the query.
OperationName string
}
ExecutionOperationRes struct {
// Data is the data returned from processing the GraphQL operation.
Data any
// Error is the error returned by processing the GraphQL Operation, if any.
Error error
}
)
// Finish the GraphQL query operation, along with the given results, and emit a finish event up in
// the operation stack.
func (q *ExecutionOperation) Finish(res ExecutionOperationRes) {
dyngo.FinishOperation(q, res)
}
func (ExecutionOperationArgs) IsArgOf(*ExecutionOperation) {}
func (ExecutionOperationRes) IsResultOf(*ExecutionOperation) {}
type (
ResolveOperation struct {
dyngo.Operation
trace.TagSetter
trace.SecurityEventsHolder
}
// ResolveOperationArgs describes arguments passed to a GraphQL field operation.
ResolveOperationArgs struct {
// TypeName is the name of the field's type
TypeName string
// FieldName is the name of the field
FieldName string
// Arguments is the arguments provided to the field resolver
Arguments map[string]any
// Trivial determines whether the resolution is trivial or not. Leave as false if undetermined.
Trivial bool
}
ResolveOperationRes struct {
// Data is the data returned from processing the GraphQL operation.
Data any
// Error is the error returned by processing the GraphQL Operation, if any.
Error error
}
)
// Finish the GraphQL Field operation, along with the given results, and emit a finish event up in
// the operation stack.
func (q *ResolveOperation) Finish(res ResolveOperationRes) {
dyngo.FinishOperation(q, res)
}
func (ResolveOperationArgs) IsArgOf(*ResolveOperation) {}
func (ResolveOperationRes) IsResultOf(*ResolveOperation) {}