pub struct Filter { /* private fields */ }Expand description
A caller-side read input: the layer-interpreted param bag — and nothing else.
This is the input for the erased read path,
ActionInput::read. Where a hand-built Query
can carry a resource name the typed call site contradicts (silently
overwritten) and load/aggregates/computed requests the erased path must
reject, a Filter can carry neither: the resource is always named by the
call site’s type parameter, and relationship loads / derived values are only
expressible on the path that resolves them, Domain::read.
use ash_domain::{ActionInput, Filter};
let input = ActionInput::read(
Filter::new().param("owner", "alice").param("limit", 50),
);Implementations§
Source§impl Filter
impl Filter
Sourcepub fn param(self, key: impl Into<String>, value: impl Into<Value>) -> Self
pub fn param(self, key: impl Into<String>, value: impl Into<Value>) -> Self
Set a param in the bag. What it means is the data layer’s convention,
exactly as Query::param — the core attaches no semantics.
Sourcepub fn params(self, params: impl IntoRecord) -> Result<Self>
pub fn params(self, params: impl IntoRecord) -> Result<Self>
Merge a whole typed param bag into the filter — the compile-checked
sibling of param. params is anything IntoRecord
(typically a #[derive(IntoRecord)] struct you define), so your layer’s
param convention gets field names and types the compiler checks instead
of strings. The core still attaches no semantics to any key — the struct
is a contract between you and your data layer, exactly as with
param. A key set both ways keeps the later value.
Fallible because IntoRecord is: an out-of-i64-range integer field
has no lossless neutral form and fails loudly here.
use ash_domain::{ActionInput, Filter, IntoRecord};
#[derive(IntoRecord)]
struct OpenTodos {
done: bool,
limit: i64,
}
let input = ActionInput::read(
Filter::new().params(OpenTodos { done: false, limit: 50 })?,
);