use crate::{
key_composer::{KeyComposer, KeyTag, SmallKey},
meta::encode_sortable_f64,
};
#[inline]
pub fn meta(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_meta_key_stack(KeyTag::ZSetMeta.as_slice(), key)
}
#[inline]
pub fn member(kc: &KeyComposer<'_>, key: &[u8], member_bytes: &[u8]) -> SmallKey {
kc.compose_subkey_stack(KeyTag::ZSetData.as_slice(), key, member_bytes)
}
#[inline]
pub fn prefix(kc: &KeyComposer<'_>, key: &[u8]) -> Vec<u8> {
kc.compose_prefix(KeyTag::ZSetData.as_slice(), key)
}
#[inline]
pub fn prefix_stack(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_prefix_stack(KeyTag::ZSetData.as_slice(), key)
}
#[inline]
pub fn score(kc: &KeyComposer<'_>, key: &[u8], score_val: f64, member_bytes: &[u8]) -> SmallKey {
let enc = encode_sortable_f64(score_val);
kc.compose_subkey2_stack(KeyTag::ZSetScore.as_slice(), key, &enc, member_bytes)
}
#[inline]
pub fn score_prefix(kc: &KeyComposer<'_>, key: &[u8]) -> Vec<u8> {
kc.compose_prefix(KeyTag::ZSetScore.as_slice(), key)
}
#[inline]
pub fn score_prefix_stack(kc: &KeyComposer<'_>, key: &[u8]) -> SmallKey {
kc.compose_prefix_stack(KeyTag::ZSetScore.as_slice(), key)
}