@@ -12,7 +12,7 @@ use crate::query_helper::placeholder::{FieldListExtractor, NonTableFieldExtracto
1212use crate :: query_helper:: tuple:: ConcatTuples ;
1313use crate :: query_helper:: { HasMany , HasOne } ;
1414use crate :: scalar:: WundergraphScalarValue ;
15- use crate :: LoadingHandler ;
15+ use crate :: { ApplyOffset , LoadingHandler } ;
1616use diesel:: associations:: HasTable ;
1717use diesel:: backend:: Backend ;
1818use diesel:: expression:: NonAggregate ;
@@ -73,7 +73,7 @@ pub trait CreateFilter {
7373
7474impl < L , DB , Ctx > CreateFilter for FilterConverter < L , DB , Ctx >
7575where
76- DB : Backend + ' static ,
76+ DB : Backend + ApplyOffset + ' static ,
7777 DB :: QueryBuilder : Default ,
7878 L :: Table : ' static ,
7979 <L :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -109,7 +109,7 @@ where
109109 L : HasTable ,
110110 O : WundergraphBelongsTo < L :: Table , DB , Ctx > ,
111111 O :: Table : ' static ,
112- DB : Backend + ' static ,
112+ DB : Backend + ApplyOffset + ' static ,
113113 <O :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
114114 DB :: QueryBuilder : Default ,
115115{
@@ -179,7 +179,7 @@ where
179179
180180impl < C , K , I , DB , Ctx > AsColumnFilter < C , DB , Ctx > for HasOne < K , I >
181181where
182- DB : Backend + ' static ,
182+ DB : Backend + ApplyOffset + ' static ,
183183 I :: Table : ' static ,
184184 I : LoadingHandler < DB , Ctx > ,
185185 <I :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -193,7 +193,7 @@ where
193193#[ allow( clippy:: use_self) ]
194194impl < C , K , I , DB , Ctx > AsColumnFilter < C , DB , Ctx > for Option < HasOne < K , I > >
195195where
196- DB : Backend + ' static ,
196+ DB : Backend + ApplyOffset + ' static ,
197197 I :: Table : ' static ,
198198 I : LoadingHandler < DB , Ctx > ,
199199 <I :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -209,7 +209,7 @@ where
209209
210210impl < L , DB , Ctx > Nameable for FilterWrapper < L , DB , Ctx >
211211where
212- DB : Backend + ' static ,
212+ DB : Backend + ApplyOffset + ' static ,
213213 L :: Table : ' static ,
214214 L : LoadingHandler < DB , Ctx > ,
215215 <L :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -231,6 +231,11 @@ where
231231 fn into_filter ( f : F ) -> Option < Self :: Ret > ;
232232
233233 fn from_inner_look_ahead ( objs : & [ ( & str , LookAheadValue < ' _ , WundergraphScalarValue > ) ] ) -> F ;
234+ fn from_inner_input_value (
235+ obj : IndexMap < & str , & InputValue < WundergraphScalarValue > > ,
236+ ) -> Option < F > ;
237+
238+ fn to_inner_input_value ( f : & F , _v : & mut IndexMap < & str , InputValue < WundergraphScalarValue > > ) ;
234239
235240 fn register_fields < ' r > (
236241 _info : & NameBuilder < ( ) > ,
@@ -240,16 +245,19 @@ where
240245
241246impl < L , DB , Ctx > BuildFilter < DB > for FilterWrapper < L , DB , Ctx >
242247where
243- DB : Backend + ' static ,
248+ DB : Backend + ApplyOffset + ' static ,
244249 L :: Table : ' static ,
245250 L : LoadingHandler < DB , Ctx > ,
246251 <L :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
247252 DB :: QueryBuilder : Default ,
248253 FilterConverter < L , DB , Ctx > : CreateFilter ,
249254 L :: Table : BuildFilterHelper < DB , <FilterConverter < L , DB , Ctx > as CreateFilter >:: Filter , Ctx > ,
250255{
251- type Ret =
252- <L :: Table as BuildFilterHelper < DB , <FilterConverter < L , DB , Ctx > as CreateFilter >:: Filter , Ctx > >:: Ret ;
256+ type Ret = <L :: Table as BuildFilterHelper <
257+ DB ,
258+ <FilterConverter < L , DB , Ctx > as CreateFilter >:: Filter ,
259+ Ctx ,
260+ > >:: Ret ;
253261
254262 fn into_filter ( self ) -> Option < Self :: Ret > {
255263 <L :: Table as BuildFilterHelper < DB , _ , Ctx > >:: into_filter ( self . filter )
@@ -261,7 +269,7 @@ pub struct FilterBuildHelper<F, L, DB, Ctx>(pub F, PhantomData<(L, DB, Ctx)>);
261269
262270impl < F , L , DB , Ctx > Nameable for FilterBuildHelper < F , L , DB , Ctx >
263271where
264- DB : Backend + ' static ,
272+ DB : Backend + ApplyOffset + ' static ,
265273 L :: Table : ' static ,
266274 L : LoadingHandler < DB , Ctx > ,
267275 <L :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -274,7 +282,7 @@ where
274282
275283impl < L , DB , Ctx > InnerFilter for FilterWrapper < L , DB , Ctx >
276284where
277- DB : Backend + ' static ,
285+ DB : Backend + ApplyOffset + ' static ,
278286 L :: Table : ' static ,
279287 L : LoadingHandler < DB , Ctx > ,
280288 <L :: Table as QuerySource >:: FromClause : QueryFragment < DB > ,
@@ -287,9 +295,11 @@ where
287295 const FIELD_COUNT : usize = L :: Table :: FIELD_COUNT ;
288296
289297 fn from_inner_input_value (
290- _obj : IndexMap < & str , & InputValue < WundergraphScalarValue > > ,
298+ obj : IndexMap < & str , & InputValue < WundergraphScalarValue > > ,
291299 ) -> Option < Self > {
292- unimplemented ! ( )
300+ Some ( Self {
301+ filter : L :: Table :: from_inner_input_value ( obj) ?,
302+ } )
293303 }
294304
295305 fn from_inner_look_ahead ( objs : & [ ( & str , LookAheadValue < ' _ , WundergraphScalarValue > ) ] ) -> Self {
@@ -298,8 +308,8 @@ where
298308 }
299309 }
300310
301- fn to_inner_input_value ( & self , _v : & mut IndexMap < & str , InputValue < WundergraphScalarValue > > ) {
302- unimplemented ! ( )
311+ fn to_inner_input_value ( & self , v : & mut IndexMap < & str , InputValue < WundergraphScalarValue > > ) {
312+ L :: Table :: to_inner_input_value ( & self . filter , v )
303313 }
304314
305315 fn register_fields < ' r > (
@@ -336,9 +346,8 @@ macro_rules! __impl_build_filter_for_tuples {
336346 }
337347 }
338348
339-
340349 impl <$( $T, ) * Loading , Back , Ctx > InnerFilter for FilterBuildHelper <( $( Option <$T>, ) * ) , Loading , Back , Ctx >
341- where Back : Backend + ' static ,
350+ where Back : Backend + ApplyOffset + ' static ,
342351 Loading :: Table : ' static ,
343352 Loading : LoadingHandler <Back , Ctx >,
344353 <Loading :: Table as QuerySource >:: FromClause : QueryFragment <Back >,
@@ -352,8 +361,18 @@ macro_rules! __impl_build_filter_for_tuples {
352361 fn from_inner_input_value(
353362 obj: IndexMap <& str , & InputValue <WundergraphScalarValue >>
354363 ) -> Option <Self > {
355- dbg!( obj) ;
356- unimplemented!( )
364+ let mut values = ( $( Option :: <$T>:: default ( ) , ) * ) ;
365+ for ( name, value) in obj {
366+ match name {
367+ $(
368+ n if n == Loading :: FIELD_NAMES [ $idx] => {
369+ values. $idx = <$T as FromInputValue <WundergraphScalarValue >>:: from_input_value( value) ;
370+ }
371+ ) *
372+ _ => { }
373+ }
374+ }
375+ Some ( FilterBuildHelper ( values, PhantomData ) )
357376 }
358377
359378 fn from_inner_look_ahead(
@@ -376,8 +395,11 @@ macro_rules! __impl_build_filter_for_tuples {
376395 fn to_inner_input_value(
377396 & self , v: & mut IndexMap <& str , InputValue <WundergraphScalarValue >>
378397 ) {
379- dbg!( v) ;
380- unimplemented!( )
398+ let inner = & self . 0 ;
399+ $(
400+ let value = <Option <$T> as ToInputValue <WundergraphScalarValue >>:: to_input_value( & inner. $idx) ;
401+ v. insert( Loading :: FIELD_NAMES [ $idx] , value) ;
402+ ) *
381403 }
382404
383405 fn register_fields<' r>(
0 commit comments