2023-11-18 13:56:13 +00:00
|
|
|
use crate::sql::duration::Duration;
|
2023-08-17 18:03:46 +00:00
|
|
|
use revision::revisioned;
|
2023-06-28 07:19:40 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use std::fmt::{self, Display, Formatter};
|
|
|
|
use std::str;
|
|
|
|
use std::time;
|
|
|
|
|
2023-08-18 22:51:56 +00:00
|
|
|
#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
|
2023-08-17 18:03:46 +00:00
|
|
|
#[revisioned(revision = 1)]
|
2023-06-28 07:19:40 +00:00
|
|
|
pub struct ChangeFeed {
|
|
|
|
pub expiry: time::Duration,
|
|
|
|
}
|
|
|
|
impl Display for ChangeFeed {
|
|
|
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
|
|
write!(f, "CHANGEFEED {}", Duration(self.expiry))?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for ChangeFeed {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
expiry: time::Duration::from_secs(0),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|