@@ -183,7 +183,7 @@ impl<'a> Display for GraphqlDefinition<'a> {
183
183
}
184
184
writeln ! ( f) ?;
185
185
writeln ! ( f) ?;
186
- write ! ( f, "wundergraph_query_object !{{" ) ?;
186
+ write ! ( f, "wundergraph::query_object !{{" ) ?;
187
187
{
188
188
let mut out = PadAdapter :: new ( f) ;
189
189
writeln ! ( out) ?;
@@ -192,14 +192,8 @@ impl<'a> Display for GraphqlDefinition<'a> {
192
192
let mut out = PadAdapter :: new ( & mut out) ;
193
193
writeln ! ( out) ?;
194
194
for t in self . tables {
195
- let uppercase = uppercase_table_name ( & t. name . name ) ;
196
195
let single = fix_table_name ( & t. name . name ) ;
197
- writeln ! (
198
- out,
199
- "{upper}({single}, filter = {single}Filter)," ,
200
- upper = uppercase,
201
- single = single
202
- ) ?;
196
+ writeln ! ( out, "{}," , single) ?;
203
197
}
204
198
}
205
199
writeln ! ( out, "}}" ) ?;
@@ -228,7 +222,8 @@ fn uppercase_table_name(name: &str) -> String {
228
222
} else {
229
223
Some ( c. to_string ( ) )
230
224
}
231
- } ) . fold ( String :: new ( ) , |acc, s| acc + & s)
225
+ } )
226
+ . fold ( String :: new ( ) , |acc, s| acc + & s)
232
227
}
233
228
234
229
fn fix_table_name ( name : & str ) -> String {
@@ -261,21 +256,12 @@ where
261
256
262
257
impl < ' a > Display for GraphqlData < ' a > {
263
258
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
264
- writeln ! ( f, "#[derive(Clone, Debug, Identifiable, WundergraphEntity)]" ) ?;
259
+ writeln ! (
260
+ f,
261
+ "#[derive(Clone, Debug, Identifiable, WundergraphEntity)]"
262
+ ) ?;
265
263
writeln ! ( f, "#[table_name = \" {}\" ]" , self . table. name. name) ?;
266
264
write_primary_key_section ( f, self . table ) ?;
267
- // for key in self
268
- // .foreign_keys
269
- // .iter()
270
- // .filter(|f| f.child_table == self.table.name)
271
- // {
272
- // writeln!(
273
- // f,
274
- // "#[belongs_to({parent}, foreign_key = \"{foreign_key}\")]",
275
- // parent = fix_table_name(&key.parent_table.name),
276
- // foreign_key = key.foreign_key
277
- // )?
278
- // }
279
265
write ! ( f, "pub struct {} {{" , fix_table_name( & self . table. name. name) ) ?;
280
266
{
281
267
let mut out = PadAdapter :: new ( f) ;
@@ -310,7 +296,6 @@ impl<'a> Display for GraphqlData<'a> {
310
296
}
311
297
}
312
298
313
-
314
299
struct GraphqlColumn < ' a > {
315
300
column : & ' a ColumnDefinition ,
316
301
foreign_key : Option < & ' a ForeignKeyConstraint > ,
@@ -354,9 +339,7 @@ impl<'a> Display for GraphqlType<'a> {
354
339
match * self . sql_type {
355
340
ColumnType {
356
341
is_nullable : true , ..
357
- }
358
- if self . allow_option =>
359
- {
342
+ } if self . allow_option => {
360
343
let mut t = self . clone ( ) ;
361
344
t. allow_option = false ;
362
345
write ! ( f, "Option<{}>" , t) ?;
@@ -433,7 +416,7 @@ impl<'a> Display for GraphqlMutations<'a> {
433
416
writeln ! ( f, "{}" , GraphqlChangeSet { table: t } ) ?;
434
417
}
435
418
436
- write ! ( f, "wundergraph_mutation_object !{{" ) ?;
419
+ write ! ( f, "wundergraph::mutation_object !{{" ) ?;
437
420
{
438
421
let mut out = PadAdapter :: new ( f) ;
439
422
writeln ! ( out) ?;
@@ -473,7 +456,7 @@ impl<'a> Display for GraphqlInsertable<'a> {
473
456
writeln ! ( f, "#[derive(Insertable, GraphQLInputObject, Clone, Debug)]" ) ?;
474
457
writeln ! ( f, "#[graphql(scalar = \" WundergraphScalarValue\" )]" ) ?;
475
458
writeln ! ( f, "#[table_name = \" {}\" ]" , self . table. name) ?;
476
- write ! ( f, "struct New{} {{" , fix_table_name( & self . table. name. name) ) ?;
459
+ write ! ( f, "pub struct New{} {{" , fix_table_name( & self . table. name. name) ) ?;
477
460
{
478
461
let mut out = PadAdapter :: new ( f) ;
479
462
writeln ! ( out) ?;
@@ -509,7 +492,7 @@ impl<'a> Display for GraphqlChangeSet<'a> {
509
492
write_primary_key_section ( f, self . table ) ?;
510
493
write ! (
511
494
f,
512
- "struct {}Changeset {{" ,
495
+ "pub struct {}Changeset {{" ,
513
496
fix_table_name( & self . table. name. name)
514
497
) ?;
515
498
{
0 commit comments