Function owoof::disperse::zip_with_keys
source · [−]pub fn zip_with_keys<K>(
keys: K
) -> impl FromSqlRow<Out = ObjectMap<<K as IntoIterator>::IntoIter, Vec<Value>>> where
K: IntoIterator,
<K as IntoIterator>::IntoIter: Clone + ExactSizeIterator,
Expand description
Given a sequence of keys (like attributes) returns an implementation of FromSqlRow
that
reads one Value
per key and outputs an ObjectMap
, a type that can
serde::Serialize
to a map of keys zipped with values.
For example, with a suitable query, you might pass two attributes ":db/id"
and
":db/attribute"
you get a map like:
{
":db/id": "#b181a977-a8a1-2998-16df-a314c607ecde",
":db/attribute": ":db/attribute"
}