51 lines
960 B
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-14 16:22:44 +08:00
pub data: Vec<u8>,
2021-07-22 21:43:01 +08:00
}
2021-09-11 14:26:30 +08:00
impl CreateDocParams {
2021-09-14 16:22:44 +08:00
pub fn new(id: &str, data: Vec<u8>) -> 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-14 16:22:44 +08:00
pub data: Vec<u8>,
#[pb(index = 3)]
pub revision: 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)]
pub id: String,
2021-07-22 21:43:01 +08:00
2021-09-14 16:22:44 +08:00
#[pb(index = 2)]
pub doc_data: Vec<u8>,
2021-09-14 16:22:44 +08:00
}
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct DocChangeset {
2021-09-14 16:22:44 +08:00
#[pb(index = 1)]
pub id: String,
#[pb(index = 2)]
2021-09-21 15:07:07 +08:00
pub data: Vec<u8>, // Delta
2021-07-22 21:43:01 +08:00
}
2021-07-22 22:26:38 +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
}