71 lines
1.2 KiB
Rust
Raw Normal View History

2021-07-22 21:43:01 +08:00
use flowy_derive::ProtoBuf;
2021-09-11 14:26:30 +08:00
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct CreateDocParams {
2021-07-22 21:43:01 +08:00
#[pb(index = 1)]
pub id: String,
2021-07-22 21:43:01 +08:00
#[pb(index = 2)]
2021-09-26 16:39:57 +08:00
pub data: String,
2021-07-22 21:43:01 +08:00
}
2021-09-11 14:26:30 +08:00
impl CreateDocParams {
2021-09-26 16:39:57 +08:00
pub fn new(id: &str, data: String) -> Self {
Self {
id: id.to_owned(),
data,
}
}
2021-09-11 14:26:30 +08:00
}
#[derive(ProtoBuf, Default, Debug, Clone, Eq, PartialEq)]
pub struct Doc {
#[pb(index = 1)]
2021-07-23 08:14:45 +08:00
pub id: String,
#[pb(index = 2)]
2021-09-26 16:39:57 +08:00
pub data: String,
#[pb(index = 3)]
pub rev_id: i64,
2021-07-22 21:43:01 +08:00
}
2021-09-11 14:26:30 +08:00
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct UpdateDocParams {
2021-09-11 14:26:30 +08:00
#[pb(index = 1)]
2021-09-23 13:15:35 +08:00
pub doc_id: String,
2021-07-22 21:43:01 +08:00
2021-09-14 16:22:44 +08:00
#[pb(index = 2)]
2021-09-26 16:39:57 +08:00
pub data: String,
#[pb(index = 3)]
pub rev_id: i64,
2021-09-14 16:22:44 +08:00
}
#[derive(ProtoBuf, Default, Debug, Clone)]
2021-09-23 13:15:35 +08:00
pub struct DocDelta {
2021-09-14 16:22:44 +08:00
#[pb(index = 1)]
2021-09-23 13:15:35 +08:00
pub doc_id: String,
2021-09-14 16:22:44 +08:00
#[pb(index = 2)]
2021-09-26 16:39:57 +08:00
pub data: String, // Delta
2021-07-22 21:43:01 +08:00
}
2021-07-22 22:26:38 +08:00
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct NewDocUser {
#[pb(index = 1)]
pub user_id: String,
#[pb(index = 2)]
pub rev_id: i64,
#[pb(index = 3)]
pub doc_id: String,
}
#[derive(ProtoBuf, Default, Debug, Clone)]
2021-09-11 14:26:30 +08:00
pub struct QueryDocParams {
2021-07-22 22:26:38 +08:00
#[pb(index = 1)]
2021-09-11 14:26:30 +08:00
pub doc_id: String,
2021-07-22 22:26:38 +08:00
}