1
1
import GraphQL
2
2
3
- extension Type {
4
-
3
+ public extension Type {
5
4
@discardableResult
6
5
/// Define and add the federated key to this type.
7
6
///
@@ -10,14 +9,14 @@ extension Type {
10
9
/// - function: The resolver function used to load this entity based on the key value.
11
10
/// - _: The key value. The name of this argument must match a Type field.
12
11
/// - Returns: Self for chaining.
13
- public func key< Arguments: Codable > (
12
+ func key< Arguments: Codable > (
14
13
at function: @escaping AsyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
15
14
@ArgumentComponentBuilder < Arguments > _ argument: ( ) -> ArgumentComponent < Arguments >
16
15
) -> Self {
17
16
keys. append ( Key ( arguments: [ argument ( ) ] , asyncResolve: function) )
18
17
return self
19
18
}
20
-
19
+
21
20
@discardableResult
22
21
/// Define and add the federated key to this type.
23
22
///
@@ -26,15 +25,15 @@ extension Type {
26
25
/// - function: The resolver function used to load this entity based on the key value.
27
26
/// - _: The key values. The names of these arguments must match Type fields.
28
27
/// - Returns: Self for chaining.
29
- public func key< Arguments: Codable > (
28
+ func key< Arguments: Codable > (
30
29
at function: @escaping AsyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
31
30
@ArgumentComponentBuilder < Arguments > _ arguments: ( )
32
- -> [ ArgumentComponent < Arguments > ] = { [ ] }
31
+ -> [ ArgumentComponent < Arguments > ] = { [ ] }
33
32
) -> Self {
34
33
keys. append ( Key ( arguments: arguments ( ) , asyncResolve: function) )
35
34
return self
36
35
}
37
-
36
+
38
37
@discardableResult
39
38
/// Define and add the federated key to this type.
40
39
///
@@ -43,14 +42,14 @@ extension Type {
43
42
/// - function: The resolver function used to load this entity based on the key value.
44
43
/// - _: The key value. The name of this argument must match a Type field.
45
44
/// - Returns: Self for chaining.
46
- public func key< Arguments: Codable > (
45
+ func key< Arguments: Codable > (
47
46
at function: @escaping SimpleAsyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
48
47
@ArgumentComponentBuilder < Arguments > _ argument: ( ) -> ArgumentComponent < Arguments >
49
48
) -> Self {
50
49
keys. append ( Key ( arguments: [ argument ( ) ] , simpleAsyncResolve: function) )
51
50
return self
52
51
}
53
-
52
+
54
53
@discardableResult
55
54
/// Define and add the federated key to this type.
56
55
///
@@ -59,15 +58,15 @@ extension Type {
59
58
/// - function: The resolver function used to load this entity based on the key value.
60
59
/// - _: The key values. The names of these arguments must match Type fields.
61
60
/// - Returns: Self for chaining.
62
- public func key< Arguments: Codable > (
61
+ func key< Arguments: Codable > (
63
62
at function: @escaping SimpleAsyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
64
63
@ArgumentComponentBuilder < Arguments > _ arguments: ( )
65
- -> [ ArgumentComponent < Arguments > ] = { [ ] }
64
+ -> [ ArgumentComponent < Arguments > ] = { [ ] }
66
65
) -> Self {
67
66
keys. append ( Key ( arguments: arguments ( ) , simpleAsyncResolve: function) )
68
67
return self
69
68
}
70
-
69
+
71
70
@discardableResult
72
71
/// Define and add the federated key to this type.
73
72
///
@@ -76,15 +75,15 @@ extension Type {
76
75
/// - function: The resolver function used to load this entity based on the key value.
77
76
/// - _: The key value. The name of this argument must match a Type field.
78
77
/// - Returns: Self for chaining.
79
- public func key< Arguments: Codable > (
78
+ func key< Arguments: Codable > (
80
79
at function: @escaping SyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
81
80
@ArgumentComponentBuilder < Arguments > _ arguments: ( )
82
- -> [ ArgumentComponent < Arguments > ] = { [ ] }
81
+ -> [ ArgumentComponent < Arguments > ] = { [ ] }
83
82
) -> Self {
84
83
keys. append ( Key ( arguments: arguments ( ) , syncResolve: function) )
85
84
return self
86
85
}
87
-
86
+
88
87
@discardableResult
89
88
/// Define and add the federated key to this type.
90
89
///
@@ -93,51 +92,51 @@ extension Type {
93
92
/// - function: The resolver function used to load this entity based on the key value.
94
93
/// - _: The key values. The names of these arguments must match Type fields.
95
94
/// - Returns: Self for chaining.
96
- public func key< Arguments: Codable > (
95
+ func key< Arguments: Codable > (
97
96
at function: @escaping SyncResolve < Resolver , Context , Arguments , ObjectType ? > ,
98
97
@ArgumentComponentBuilder < Arguments > _ argument: ( ) -> ArgumentComponent < Arguments >
99
98
) -> Self {
100
99
keys. append ( Key ( arguments: [ argument ( ) ] , syncResolve: function) )
101
100
return self
102
101
}
103
102
}
104
-
103
+
105
104
#if compiler(>=5.5) && canImport(_Concurrency)
106
105
107
- public extension Type {
108
- @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
109
- @discardableResult
110
- /// Define and add the federated key to this type.
111
- ///
112
- /// For more information, see https://www.apollographql.com/docs/federation/entities
113
- /// - Parameters:
114
- /// - function: The resolver function used to load this entity based on the key value.
115
- /// - _: The key value. The name of this argument must match a Type field.
116
- /// - Returns: Self for chaining.
117
- func key< Arguments: Codable > (
118
- at function: @escaping ConcurrentResolve < Resolver , Context , Arguments , ObjectType ? > ,
119
- @ArgumentComponentBuilder < Arguments > _ argument: ( ) -> ArgumentComponent < Arguments >
120
- ) -> Self {
121
- keys. append ( Key ( arguments: [ argument ( ) ] , concurrentResolve: function) )
122
- return self
123
- }
124
-
125
- @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
126
- @discardableResult
127
- /// Define and add the federated key to this type.
128
- ///
129
- /// For more information, see https://www.apollographql.com/docs/federation/entities
130
- /// - Parameters:
131
- /// - function: The resolver function used to load this entity based on the key value.
132
- /// - _: The key values. The names of these arguments must match Type fields.
133
- /// - Returns: Self for chaining.
134
- func key< Arguments: Codable > (
135
- at function: @escaping ConcurrentResolve < Resolver , Context , Arguments , ObjectType ? > ,
136
- @ArgumentComponentBuilder < Arguments > _ arguments: ( ) -> [ ArgumentComponent < Arguments > ]
137
- ) -> Self {
138
- keys. append ( Key ( arguments: arguments ( ) , concurrentResolve: function) )
139
- return self
106
+ public extension Type {
107
+ @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
108
+ @discardableResult
109
+ /// Define and add the federated key to this type.
110
+ ///
111
+ /// For more information, see https://www.apollographql.com/docs/federation/entities
112
+ /// - Parameters:
113
+ /// - function: The resolver function used to load this entity based on the key value.
114
+ /// - _: The key value. The name of this argument must match a Type field.
115
+ /// - Returns: Self for chaining.
116
+ func key< Arguments: Codable > (
117
+ at function: @escaping ConcurrentResolve < Resolver , Context , Arguments , ObjectType ? > ,
118
+ @ArgumentComponentBuilder < Arguments > _ argument: ( ) -> ArgumentComponent < Arguments >
119
+ ) -> Self {
120
+ keys. append ( Key ( arguments: [ argument ( ) ] , concurrentResolve: function) )
121
+ return self
122
+ }
123
+
124
+ @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
125
+ @discardableResult
126
+ /// Define and add the federated key to this type.
127
+ ///
128
+ /// For more information, see https://www.apollographql.com/docs/federation/entities
129
+ /// - Parameters:
130
+ /// - function: The resolver function used to load this entity based on the key value.
131
+ /// - _: The key values. The names of these arguments must match Type fields.
132
+ /// - Returns: Self for chaining.
133
+ func key< Arguments: Codable > (
134
+ at function: @escaping ConcurrentResolve < Resolver , Context , Arguments , ObjectType ? > ,
135
+ @ArgumentComponentBuilder < Arguments > _ arguments: ( ) -> [ ArgumentComponent < Arguments > ]
136
+ ) -> Self {
137
+ keys. append ( Key ( arguments: arguments ( ) , concurrentResolve: function) )
138
+ return self
139
+ }
140
140
}
141
- }
142
141
143
142
#endif
0 commit comments