use alloc::string::String;
use alloc::vec::Vec;
use serde::{Deserialize, Serialize};
use crate::db::Scope;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum Cursor {
After(Vec<u8>),
At(Vec<u8>),
Skip(usize),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[allow(missing_docs)]
pub enum TbOrderBy {
#[default]
KeyAsc,
KeyDesc,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbAppendRequest {
pub scope: Scope,
pub table: String,
pub eid: Option<Vec<u8>>,
pub value: Vec<u8>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbInsertRequest {
pub scope: Scope,
pub table: String,
pub eid: Option<Vec<u8>>,
pub value: Vec<u8>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TbInsertResponse {
pub eid: Vec<u8>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbCountRequest {
pub scope: Scope,
pub table: String,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbCountResponse {
pub count: usize,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbGetRequest {
pub scope: Scope,
pub table: String,
pub eid: Vec<u8>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TbGetResponse {
pub value: Option<Vec<u8>>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbListRequest {
pub scope: Scope,
pub table: String,
pub cursor: Option<Cursor>,
pub limit: Option<usize>,
pub order: Option<TbOrderBy>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TbListResponse {
pub entities: Vec<(Vec<u8>, Vec<u8>)>,
}
#[derive(Debug, Serialize, Deserialize)]
#[allow(missing_docs)]
pub struct TbDeleteRequest {
pub scope: Scope,
pub table: String,
pub eid: Vec<u8>,
}