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)]
|
2021-07-23 14:37:18 +08:00
|
|
|
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 {
|
2021-09-09 15:43:05 +08:00
|
|
|
#[pb(index = 1)]
|
2021-07-23 08:14:45 +08:00
|
|
|
pub id: String,
|
2021-09-09 15:43:05 +08:00
|
|
|
|
|
|
|
|
#[pb(index = 2)]
|
2021-09-26 16:39:57 +08:00
|
|
|
pub data: String,
|
2021-09-22 23:21:44 +08:00
|
|
|
|
|
|
|
|
#[pb(index = 3)]
|
2021-09-25 21:47:02 +08:00
|
|
|
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)]
|
2021-09-22 23:21:44 +08:00
|
|
|
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,
|
2021-09-25 21:47:02 +08:00
|
|
|
|
|
|
|
|
#[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
|
|
|
|
2021-10-03 11:33:19 +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,
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-09 15:43:05 +08:00
|
|
|
#[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
|
|
|
}
|