doc.rs 1001 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. use flowy_derive::ProtoBuf;
  2. #[derive(ProtoBuf, Default, Debug, Clone)]
  3. pub struct CreateDocParams {
  4. #[pb(index = 1)]
  5. pub id: String,
  6. #[pb(index = 2)]
  7. pub data: Vec<u8>,
  8. }
  9. impl CreateDocParams {
  10. pub fn new(id: &str, data: Vec<u8>) -> Self { Self { id: id.to_owned(), data } }
  11. }
  12. #[derive(ProtoBuf, Default, Debug, Clone, Eq, PartialEq)]
  13. pub struct Doc {
  14. #[pb(index = 1)]
  15. pub id: String,
  16. #[pb(index = 2)]
  17. pub data: Vec<u8>,
  18. #[pb(index = 3)]
  19. pub rev_id: i64,
  20. }
  21. #[derive(ProtoBuf, Default, Debug, Clone)]
  22. pub struct UpdateDocParams {
  23. #[pb(index = 1)]
  24. pub doc_id: String,
  25. #[pb(index = 2)]
  26. pub data: Vec<u8>,
  27. #[pb(index = 3)]
  28. pub rev_id: i64,
  29. }
  30. #[derive(ProtoBuf, Default, Debug, Clone)]
  31. pub struct DocDelta {
  32. #[pb(index = 1)]
  33. pub doc_id: String,
  34. #[pb(index = 2)]
  35. pub data: Vec<u8>, // Delta
  36. }
  37. #[derive(ProtoBuf, Default, Debug, Clone)]
  38. pub struct QueryDocParams {
  39. #[pb(index = 1)]
  40. pub doc_id: String,
  41. }