use crate::grpc_wrapper::raw_table_service::copy_table::RawCopyTableItem;
#[derive(Clone)]
pub struct CopyTableItem {
inner: RawCopyTableItem,
}
impl CopyTableItem {
#[allow(dead_code)]
pub fn new(source_path: String, destination_path: String, omit_indexes: bool) -> Self {
Self {
inner: RawCopyTableItem {
source_path,
destination_path,
omit_indexes,
},
}
}
}
impl From<CopyTableItem> for RawCopyTableItem {
fn from(value: CopyTableItem) -> Self {
value.inner
}
}
#[derive(Debug, Clone)]
pub struct TableDescription {
pub columns: Vec<ColumnDescription>,
pub primary_key: Vec<String>,
pub indexes: Vec<IndexDescription>,
pub store_type: StoreType,
}
#[derive(Debug, Clone)]
pub struct UnknownTypeDescription {
pub error: String,
}
#[derive(Debug, Clone)]
pub struct ColumnDescription {
pub name: String,
pub type_value: Result<crate::Value, UnknownTypeDescription>,
pub family: String,
}
#[derive(Debug, Clone)]
pub struct IndexDescription {
pub name: String,
pub index_columns: Vec<String>,
pub data_columns: Vec<String>,
pub status: IndexStatus,
pub index_type: IndexType,
}
impl From<crate::grpc_wrapper::raw_table_service::describe_table::RawIndexDescription>
for IndexDescription
{
fn from(
raw: crate::grpc_wrapper::raw_table_service::describe_table::RawIndexDescription,
) -> Self {
Self {
name: raw.name,
index_columns: raw.index_columns,
data_columns: raw.data_columns,
status: raw.status.into(),
index_type: raw.index_type.into(),
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(not(feature = "force-exhaustive-all"), non_exhaustive)]
pub enum IndexType {
Unspecified,
Global,
GlobalAsync,
GlobalUnique,
}
impl From<crate::grpc_wrapper::raw_table_service::describe_table::RawIndexType> for IndexType {
fn from(raw: crate::grpc_wrapper::raw_table_service::describe_table::RawIndexType) -> Self {
use crate::grpc_wrapper::raw_table_service::describe_table::RawIndexType;
match raw {
RawIndexType::Unspecified => IndexType::Unspecified,
RawIndexType::Global => IndexType::Global,
RawIndexType::GlobalAsync => IndexType::GlobalAsync,
RawIndexType::GlobalUnique => IndexType::GlobalUnique,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(not(feature = "force-exhaustive-all"), non_exhaustive)]
pub enum IndexStatus {
Unspecified,
Ready,
Building,
}
impl From<crate::grpc_wrapper::raw_table_service::describe_table::RawIndexStatus> for IndexStatus {
fn from(raw: crate::grpc_wrapper::raw_table_service::describe_table::RawIndexStatus) -> Self {
use crate::grpc_wrapper::raw_table_service::describe_table::RawIndexStatus;
match raw {
RawIndexStatus::Unspecified => IndexStatus::Unspecified,
RawIndexStatus::Ready => IndexStatus::Ready,
RawIndexStatus::Building => IndexStatus::Building,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(not(feature = "force-exhaustive-all"), non_exhaustive)]
pub enum StoreType {
Unspecified,
Row,
Column,
}
impl From<crate::grpc_wrapper::raw_table_service::describe_table::RawStoreType> for StoreType {
fn from(raw: crate::grpc_wrapper::raw_table_service::describe_table::RawStoreType) -> Self {
use crate::grpc_wrapper::raw_table_service::describe_table::RawStoreType;
match raw {
RawStoreType::Unspecified => StoreType::Unspecified,
RawStoreType::Row => StoreType::Row,
RawStoreType::Column => StoreType::Column,
}
}
}