in akd_mysql/src/mysql_storables.rs [385:451]
fn get_multi_row_specific_params<St: Storable>(
keys: &[St::Key],
) -> Option<mysql_async::Params> {
match St::data_type() {
StorageType::Azks => None,
StorageType::HistoryNodeState => {
let pvec = keys
.iter()
.enumerate()
.map(|(idx, key)| {
// Since these are constructed from a safe key, they should never fail
// so we'll leave the unwrap to simplify
let bin = St::get_full_binary_key_id(key);
let back: NodeStateKey =
HistoryNodeState::key_from_full_binary(&bin).unwrap();
vec![
(format!("label_len{}", idx), Value::from(back.0.len)),
(format!("label_val{}", idx), Value::from(back.0.val)),
(format!("epoch{}", idx), Value::from(back.1)),
]
})
.into_iter()
.flatten()
.collect::<Vec<_>>();
Some(mysql_async::Params::from(pvec))
}
StorageType::HistoryTreeNode => {
let pvec = keys
.iter()
.enumerate()
.map(|(idx, key)| {
let bin = St::get_full_binary_key_id(key);
// Since these are constructed from a safe key, they should never fail
// so we'll leave the unwrap to simplify
let back: NodeKey = HistoryTreeNode::key_from_full_binary(&bin).unwrap();
vec![
(format!("label_len{}", idx), Value::from(back.0.len)),
(format!("label_val{}", idx), Value::from(back.0.val)),
]
})
.into_iter()
.flatten()
.collect::<Vec<_>>();
Some(mysql_async::Params::from(pvec))
}
StorageType::ValueState => {
let pvec = keys
.iter()
.enumerate()
.map(|(idx, key)| {
let bin = St::get_full_binary_key_id(key);
// Since these are constructed from a safe key, they should never fail
// so we'll leave the unwrap to simplify
let back: akd::storage::types::ValueStateKey =
akd::storage::types::ValueState::key_from_full_binary(&bin).unwrap();
vec![
(format!("username{}", idx), Value::from(back.0.clone())),
(format!("epoch{}", idx), Value::from(back.1)),
]
})
.into_iter()
.flatten()
.collect::<Vec<_>>();
Some(mysql_async::Params::from(pvec))
}
}
}