use std::time::{Duration, SystemTime};
#[derive(Debug, Clone, PartialEq)]
pub struct SortedSetEntry {
pub member: String,
pub score: f64,
}
impl SortedSetEntry {
pub fn new(member: impl Into<String>, score: f64) -> Self {
Self {
member: member.into(),
score,
}
}
}
impl<S: Into<String>> From<(S, f64)> for SortedSetEntry {
fn from((member, score): (S, f64)) -> Self {
Self::new(member, score)
}
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum FieldExpireCondition {
#[default]
Always,
IfNoTtl,
IfTtl,
IfGreater,
IfLess,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct SortedSetAddOptions {
pub if_not_exists: bool,
pub if_exists: bool,
pub greater_than: bool,
pub less_than: bool,
pub changed: bool,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct StreamReadOptions {
pub count: Option<u64>,
pub block: Option<Duration>,
pub no_ack: bool,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct StreamClaimOptions {
pub idle: Option<Duration>,
pub time: Option<SystemTime>,
pub retry_count: Option<u64>,
pub force: bool,
pub last_id: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq)]
pub struct StreamPendingFilter {
pub consumer: Option<String>,
pub min_idle: Option<Duration>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StreamPendingEntry {
pub id: String,
pub consumer: String,
pub idle_millis: i64,
pub delivery_count: i64,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ScanPage {
pub cursor: u64,
pub keys: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct HashScanPage {
pub cursor: u64,
pub fields: Vec<(String, String)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StreamEntry {
pub id: String,
pub fields: Vec<(String, String)>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StreamReadResult {
pub key: String,
pub entries: Vec<StreamEntry>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PubSubMessage {
pub kind: String,
pub pattern: Option<String>,
pub channel: String,
pub payload: Vec<u8>,
}