use crate::types::{BoltDict, BoltValue};
#[derive(Debug, Clone, PartialEq)]
pub enum ClientMessage {
Hello { extra: BoltDict },
Logon { auth: BoltDict },
Logoff,
Goodbye,
Reset,
Run {
query: String,
parameters: BoltDict,
extra: BoltDict,
},
Pull { extra: BoltDict },
Discard { extra: BoltDict },
Begin { extra: BoltDict },
Commit,
Rollback,
Route {
routing: BoltDict,
bookmarks: Vec<String>,
extra: BoltDict,
},
Telemetry { api: i64 },
}
impl ClientMessage {
pub fn pull_all() -> Self {
Self::Pull {
extra: BoltDict::from([("n".to_string(), BoltValue::Integer(-1))]),
}
}
pub fn pull_n(n: i64) -> Self {
Self::Pull {
extra: BoltDict::from([("n".to_string(), BoltValue::Integer(n))]),
}
}
pub fn discard_all() -> Self {
Self::Discard {
extra: BoltDict::from([("n".to_string(), BoltValue::Integer(-1))]),
}
}
}