add json array to serde_json::Value db deserialization without Raw
This commit is contained in:
parent
72797532b6
commit
77d7e8a3ad
2 changed files with 9 additions and 8 deletions
|
@ -947,13 +947,12 @@ impl Service {
|
|||
user_id: &UserId,
|
||||
profile_key: &str,
|
||||
) -> Result<serde_json::Value> {
|
||||
let key = (user_id, profile_key);
|
||||
self.db
|
||||
.useridprofilekey_value
|
||||
.qry(&(user_id, profile_key))
|
||||
.qry(&key)
|
||||
.await
|
||||
.deserialized::<Raw<serde_json::Value>>()
|
||||
.map(serde_json::to_value)?
|
||||
.map_err(Into::into)
|
||||
.deserialized()
|
||||
}
|
||||
|
||||
/// Gets all the user's profile keys and values in an iterator
|
||||
|
@ -961,16 +960,14 @@ impl Service {
|
|||
&'a self,
|
||||
user_id: &'a UserId,
|
||||
) -> impl Stream<Item = (String, serde_json::Value)> + 'a + Send {
|
||||
type KeyVal = ((Ignore, String), Raw<serde_json::Value>);
|
||||
type KeyVal = ((Ignore, String), serde_json::Value);
|
||||
|
||||
let prefix = (user_id, Interfix);
|
||||
self.db
|
||||
.useridprofilekey_value
|
||||
.stream_prefix(&prefix)
|
||||
.ignore_err()
|
||||
.ready_filter_map(|((_, key), val): KeyVal| {
|
||||
Some((key, serde_json::to_value(val).ok()?))
|
||||
})
|
||||
.map(|((_, key), val): KeyVal| (key, val))
|
||||
}
|
||||
|
||||
/// Sets a new profile key value, removes the key if value is None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue