@@ -82,6 +82,19 @@ impl From<&str> for EntityType {
8282
8383impl CheapClone for EntityType { }
8484
85+ #[ derive( Clone , Debug , Serialize , Deserialize , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
86+ pub struct EntityFilterDerivative ( bool ) ;
87+
88+ impl EntityFilterDerivative {
89+ pub fn new ( derived : bool ) -> Self {
90+ Self ( derived)
91+ }
92+
93+ pub fn is_derived ( & self ) -> bool {
94+ self . 0
95+ }
96+ }
97+
8598// Note: Do not modify fields without making a backward compatible change to
8699// the StableHash impl (below)
87100/// Key by which an individual entity in the store can be accessed.
@@ -166,6 +179,13 @@ fn key_stable_hash() {
166179 "905b57035d6f98cff8281e7b055e10570a2bd31190507341c6716af2d3c1ad98" ,
167180 ) ;
168181}
182+ #[ derive( Clone , Debug , PartialEq ) ]
183+ pub struct Child {
184+ pub attr : Attribute ,
185+ pub entity_type : EntityType ,
186+ pub filter : Box < EntityFilter > ,
187+ pub derived : bool ,
188+ }
169189
170190/// Supported types of store filters.
171191#[ derive( Clone , Debug , PartialEq ) ]
@@ -193,6 +213,7 @@ pub enum EntityFilter {
193213 NotEndsWith ( Attribute , Value ) ,
194214 NotEndsWithNoCase ( Attribute , Value ) ,
195215 ChangeBlockGte ( BlockNumber ) ,
216+ Child ( Child ) ,
196217}
197218
198219// A somewhat concise string representation of a filter
@@ -236,6 +257,13 @@ impl fmt::Display for EntityFilter {
236257 NotEndsWith ( a, v) => write ! ( f, "{a} !~ *{v}$" ) ,
237258 NotEndsWithNoCase ( a, v) => write ! ( f, "{a} !~ *{v}$i" ) ,
238259 ChangeBlockGte ( b) => write ! ( f, "block >= {b}" ) ,
260+ Child ( child /* a, et, cf, _ */ ) => write ! (
261+ f,
262+ "join on {} with {}({})" ,
263+ child. attr,
264+ child. entity_type,
265+ child. filter. to_string( )
266+ ) ,
239267 }
240268 }
241269}
0 commit comments