2021-07-22 21:43:01 +08:00
|
|
|
use flowy_derive::ProtoBuf;
|
|
|
|
|
use std::convert::TryInto;
|
|
|
|
|
|
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-09 15:43:05 +08:00
|
|
|
pub data: String,
|
2021-07-22 21:43:01 +08:00
|
|
|
}
|
|
|
|
|
|
2021-09-11 14:26:30 +08:00
|
|
|
impl CreateDocParams {
|
|
|
|
|
pub fn new(id: &str, data: &str) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
id: id.to_owned(),
|
|
|
|
|
data: data.to_owned(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[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)]
|
|
|
|
|
pub data: String,
|
2021-07-22 21:43:01 +08:00
|
|
|
}
|
|
|
|
|
|
2021-09-11 14:26:30 +08:00
|
|
|
#[derive(ProtoBuf, Default, Debug, Clone)]
|
|
|
|
|
pub struct UpdateDocParams {
|
|
|
|
|
#[pb(index = 1)]
|
|
|
|
|
pub id: String,
|
2021-07-22 21:43:01 +08:00
|
|
|
|
2021-09-11 14:26:30 +08:00
|
|
|
#[pb(index = 2, one_of)]
|
|
|
|
|
pub data: Option<String>,
|
2021-07-22 21:43:01 +08:00
|
|
|
}
|
2021-07-22 22:26:38 +08:00
|
|
|
|
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
|
|
|
}
|