Trait django_query::filtering::MetaVisitor
source · [−]pub trait MetaVisitor<R> {
fn visit_member<F, O, T>(&mut self, name: &str, member: &F, defop: O)
where
F: Member<R, Value = T> + Clone + 'static,
O: OperatorClass<<T as Operable>::Base> + 'static,
<O as OperatorClass<<T as Operable>::Base>>::Instance: 'static,
T: Operable;
fn visit_record<F, T, U>(&mut self, name: &str, field: &F, inner_record: &T)
where
F: Field<R, Value = U> + Clone + 'static,
T: Meta<U> + 'static,
U: 'static;
}
Expand description
Something that can receive callbacks about the members and fields in a Meta.
A MetaVisitor
can be passed to Meta::accept_visitor to
receive a callback for each of the exposed members of a type.
Required methods
fn visit_member<F, O, T>(&mut self, name: &str, member: &F, defop: O) where
F: Member<R, Value = T> + Clone + 'static,
O: OperatorClass<<T as Operable>::Base> + 'static,
<O as OperatorClass<<T as Operable>::Base>>::Instance: 'static,
T: Operable,
fn visit_member<F, O, T>(&mut self, name: &str, member: &F, defop: O) where
F: Member<R, Value = T> + Clone + 'static,
O: OperatorClass<<T as Operable>::Base> + 'static,
<O as OperatorClass<<T as Operable>::Base>>::Instance: 'static,
T: Operable,
This should be called by Meta for each exposed structure field which is Operable. Here:
name
is the name of the field, as exposed.member
is the Member for that field.defop
is the default OperatorClass for that field, which should be applied when no operator is specified (i.e. in the"record__field"
case as opposed to the"record__field__op"
case)
This should be called by Meta for each exposed structure field which can be traversed, that is where the type of the field is itself a structured type, for example when modelling foreign keys. Here:
name
is the name of the field, as exposed.field
is the Field for that field (note the difference: there are no exposed operators for a Field, and operators are applied to the record type, since there could be no one Operable::Base type.inner_record
is the Meta for the field.