FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/samples/validation/schema/QueryObject.h at main · gitmodimo/cppgraphqlgen · GitHub
gitmodimo
cppgraphqlgen
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
samples
/
validation
/
schema
/
QueryObject.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
340 lines (291 loc) · 11 KB
Breadcrumbs
cppgraphqlgen
/
samples
/
validation
/
schema
/
QueryObject.h
Copy path
File metadata and controls
340 lines (291 loc) · 11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
//
Copyright (c) Microsoft Corporation. All rights reserved.
//
Licensed under the MIT License.
//
WARNING! Do not edit this file manually, your changes will be overwritten.
#
pragma
once
#
ifndef
QUERYOBJECT_H
#
define
QUERYOBJECT_H
#
include
"
ValidationSchema.h
"
namespace
graphql
::validation::object {
namespace
methods
::QueryHas {
template
<
class
TImpl
>
concept
getDogWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<Dog>> { impl.
getDog
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getDog =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<Dog>> { impl.
getDog
() } };
};
template
<
class
TImpl
>
concept
getHumanWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<Human>> { impl.
getHuman
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getHuman =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<Human>> { impl.
getHuman
() } };
};
template
<
class
TImpl
>
concept
getPetWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<Pet>> { impl.
getPet
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getPet =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<Pet>> { impl.
getPet
() } };
};
template
<
class
TImpl
>
concept
getCatOrDogWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<CatOrDog>> { impl.
getCatOrDog
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getCatOrDog =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<CatOrDog>> { impl.
getCatOrDog
() } };
};
template
<
class
TImpl
>
concept
getArgumentsWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<Arguments>> { impl.
getArguments
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getArguments =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<Arguments>> { impl.
getArguments
() } };
};
template
<
class
TImpl
>
concept
getResourceWithParams =
requires
(TImpl impl, service::FieldParams params)
{
{ service::AwaitableObject<std::shared_ptr<Resource>> { impl.
getResource
(
std::move
(params)) } };
};
template
<
class
TImpl
>
concept
getResource =
requires
(TImpl impl)
{
{ service::AwaitableObject<std::shared_ptr<Resource>> { impl.
getResource
() } };
};
template
<
class
TImpl
>
concept
getFindDogWithParams =
requires
(TImpl impl, service::FieldParams params, std::unique_ptr<ComplexInput> complexArg)
{
{ service::AwaitableObject<std::shared_ptr<Dog>> { impl.
getFindDog
(
std::move
(params),
std::move
(complexArg)) } };
};
template
<
class
TImpl
>
concept
getFindDog =
requires
(TImpl impl, std::unique_ptr<ComplexInput> complexArg)
{
{ service::AwaitableObject<std::shared_ptr<Dog>> { impl.
getFindDog
(
std::move
(complexArg)) } };
};
template
<
class
TImpl
>
concept
getBooleanListWithParams =
requires
(TImpl impl, service::FieldParams params, std::optional<std::vector<
bool
>> booleanListArgArg)
{
{ service::AwaitableScalar<std::optional<
bool
>> { impl.
getBooleanList
(
std::move
(params),
std::move
(booleanListArgArg)) } };
};
template
<
class
TImpl
>
concept
getBooleanList =
requires
(TImpl impl, std::optional<std::vector<
bool
>> booleanListArgArg)
{
{ service::AwaitableScalar<std::optional<
bool
>> { impl.
getBooleanList
(
std::move
(booleanListArgArg)) } };
};
template
<
class
TImpl
>
concept
beginSelectionSet =
requires
(TImpl impl,
const
service::SelectionSetParams params)
{
{ impl.
beginSelectionSet
(params) };
};
template
<
class
TImpl
>
concept
endSelectionSet =
requires
(TImpl impl,
const
service::SelectionSetParams params)
{
{ impl.
endSelectionSet
(params) };
};
}
//
namespace methods::QueryHas
class
[[nodiscard]]
Query
final
: public service::Object
{
private:
[[nodiscard]]
service::AwaitableResolver
resolveDog
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveHuman
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolvePet
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveCatOrDog
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveArguments
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveResource
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveFindDog
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolveBooleanList
(service::ResolverParams&& params)
const
;
[[nodiscard]]
service::AwaitableResolver
resolve_typename
(service::ResolverParams&& params)
const
;
struct
[[nodiscard]]
Concept
{
virtual
~Concept
() =
default
;
virtual
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
=
0
;
virtual
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Dog>>
getDog
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Human>>
getHuman
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Pet>>
getPet
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<CatOrDog>>
getCatOrDog
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Arguments>>
getArguments
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Resource>>
getResource
(service::FieldParams&& params)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableObject<std::shared_ptr<Dog>>
getFindDog
(service::FieldParams&& params, std::unique_ptr<ComplexInput>&& complexArg)
const
=
0
;
[[nodiscard]]
virtual
service::AwaitableScalar<std::optional<
bool
>>
getBooleanList
(service::FieldParams&& params, std::optional<std::vector<
bool
>>&& booleanListArgArg)
const
=
0
;
};
template
<
class
T
>
struct
[[nodiscard]]
Model
: Concept
{
Model
(std::shared_ptr<T>&& pimpl)
noexcept
: _pimpl {
std::move
(pimpl) }
{
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Dog>>
getDog
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getDogWithParams<T>)
{
return
{ _pimpl->
getDog
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getDog<T>)
{
return
{ _pimpl->
getDog
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getDog is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Human>>
getHuman
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getHumanWithParams<T>)
{
return
{ _pimpl->
getHuman
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getHuman<T>)
{
return
{ _pimpl->
getHuman
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getHuman is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Pet>>
getPet
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getPetWithParams<T>)
{
return
{ _pimpl->
getPet
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getPet<T>)
{
return
{ _pimpl->
getPet
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getPet is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<CatOrDog>>
getCatOrDog
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getCatOrDogWithParams<T>)
{
return
{ _pimpl->
getCatOrDog
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getCatOrDog<T>)
{
return
{ _pimpl->
getCatOrDog
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getCatOrDog is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Arguments>>
getArguments
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getArgumentsWithParams<T>)
{
return
{ _pimpl->
getArguments
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getArguments<T>)
{
return
{ _pimpl->
getArguments
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getArguments is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Resource>>
getResource
(service::FieldParams&& params)
const
final
{
if
constexpr
(methods::QueryHas::getResourceWithParams<T>)
{
return
{ _pimpl->
getResource
(
std::move
(params)) };
}
else
if
constexpr
(methods::QueryHas::getResource<T>)
{
return
{ _pimpl->
getResource
() };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getResource is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableObject<std::shared_ptr<Dog>>
getFindDog
(service::FieldParams&& params, std::unique_ptr<ComplexInput>&& complexArg)
const
final
{
if
constexpr
(methods::QueryHas::getFindDogWithParams<T>)
{
return
{ _pimpl->
getFindDog
(
std::move
(params),
std::move
(complexArg)) };
}
else
if
constexpr
(methods::QueryHas::getFindDog<T>)
{
return
{ _pimpl->
getFindDog
(
std::move
(complexArg)) };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getFindDog is not implemented
)ex"
);
}
}
[[nodiscard]]
service::AwaitableScalar<std::optional<
bool
>>
getBooleanList
(service::FieldParams&& params, std::optional<std::vector<
bool
>>&& booleanListArgArg)
const
final
{
if
constexpr
(methods::QueryHas::getBooleanListWithParams<T>)
{
return
{ _pimpl->
getBooleanList
(
std::move
(params),
std::move
(booleanListArgArg)) };
}
else
if
constexpr
(methods::QueryHas::getBooleanList<T>)
{
return
{ _pimpl->
getBooleanList
(
std::move
(booleanListArgArg)) };
}
else
{
throw
std::runtime_error
(
R"ex(
Query::getBooleanList is not implemented
)ex"
);
}
}
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
final
{
if
constexpr
(methods::QueryHas::beginSelectionSet<T>)
{
_pimpl->
beginSelectionSet
(params);
}
}
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
final
{
if
constexpr
(methods::QueryHas::endSelectionSet<T>)
{
_pimpl->
endSelectionSet
(params);
}
}
private:
const
std::shared_ptr<T> _pimpl;
};
Query
(std::unique_ptr<
const
Concept>&& pimpl)
noexcept
;
[[nodiscard]]
service::TypeNames
getTypeNames
()
const
noexcept
;
[[nodiscard]]
service::ResolverMap
getResolvers
()
const
noexcept
;
void
beginSelectionSet
(
const
service::SelectionSetParams& params)
const
final
;
void
endSelectionSet
(
const
service::SelectionSetParams& params)
const
final
;
const
std::unique_ptr<
const
Concept> _pimpl;
public:
template
<
class
T
>
Query
(std::shared_ptr<T> pimpl)
noexcept
: Query { std::unique_ptr<
const
Concept> { std::make_unique<Model<T>>(
std::move
(pimpl)) } }
{
}
[[nodiscard]]
static
constexpr
std::string_view
getObjectType
()
noexcept
{
return
{
R"gql(
Query
)gql"
};
}
};
}
//
namespace graphql::validation::object
#
endif
//
QUERYOBJECT_H
Back
|
FazBrowse Home
|
New Git URL