pub struct NestedEndpointWithContext<T>where
T: Send + Sync + RowSource,
for<'t> &'t <<T as RowSource>::Rows as RowSet>::Target: IntoIterator<Item = &'t <T as RowSource>::Item>,{ /* private fields */ }
wiremock
only.Expand description
A Django nested route for types that need a context value.
A nested route in Django is a way of specifying that a particular
filter field must be present when querying for a particular object
type, and that the filter type must be exact match. So for
example, if all objects of type Foo
have a reference to a Bar
,
and its too expensive or undesirable to query for Foo
s without
specifying which Bar
they come from, then you can express this
in Django as a nested route:
http://example.com/bars/1/foos
where in order to ask any question about Foo
s you must first
identify a particular associated Bar
.
Since the django-query crate operates on query parameters, the
simplest way to handle this is to convert any relevant parts of
the path into query parameters as required, which is all this type
does. See its construction parameters NestedEndpointParams
for
the details. This type is otherwise identical to
EndpointWithContext
.
Implementations§
Source§impl<'q, T> NestedEndpointWithContext<T>
impl<'q, T> NestedEndpointWithContext<T>
Sourcepub fn new(row_source: T, p: NestedEndpointParams<'_>) -> Self
pub fn new(row_source: T, p: NestedEndpointParams<'_>) -> Self
Create a new NestedEndpointWithContext
.
The arguments to this function are wrapped in their own
structure: NestedEndpointParams
.
pub fn default_limit(&mut self, limit: usize)
Trait Implementations§
Source§impl<'q, T, A, R> Respond for NestedEndpointWithContext<T>where
T: Send + Sync + RowSource<Rows = A, Item = R>,
for<'t> &'t <A as RowSet>::Target: IntoIterator<Item = &'t R>,
R: Send + Sync + FilterableWithContext<'q, A> + SortableWithContext<'q, A> + IntoRowWithContext<'q, A> + 'q,
A: Clone + 'q + RowSet,
impl<'q, T, A, R> Respond for NestedEndpointWithContext<T>where
T: Send + Sync + RowSource<Rows = A, Item = R>,
for<'t> &'t <A as RowSet>::Target: IntoIterator<Item = &'t R>,
R: Send + Sync + FilterableWithContext<'q, A> + SortableWithContext<'q, A> + IntoRowWithContext<'q, A> + 'q,
A: Clone + 'q + RowSet,
Source§fn respond(&self, request: &Request) -> ResponseTemplate
fn respond(&self, request: &Request) -> ResponseTemplate
Request
return a ResponseTemplate
that will be used
by the MockServer
as blueprint for the response returned to the client.