tina-core 0.0.2

Tina platform
Documentation
//! excel支持

use crate::tina::server::session::Session;
use indexmap::IndexMap;
use serde::Serialize;
use serde_json::Value;

use super::data::AppResult;

/// Excel Sheet
#[async_trait]
pub trait IExcelSheet: Send + Sync + 'static {
    /// 获取 Sheet 名称
    async fn get_sheet_name(&self, session: &Session) -> AppResult<String>;
}

/// Excel Row
#[async_trait]
pub trait IExcelRow: Serialize + Send + Sync + 'static {
    /// 获取 Sheet列 与 属性的 映射
    async fn get_field_column_mapping(&self, session: &Session) -> AppResult<IndexMap<String, String>>;
    /// 获取 Sheet列 的 字典映射
    async fn get_field_dict(&self, session: &Session) -> AppResult<IndexMap<String, String>>;
    /// 获取 Sheet列 的 枚举映射
    async fn get_field_enum_mapping(&self, session: &Session) -> AppResult<IndexMap<String, IndexMap<String, String>>>;
    /// 获取 Sheet 数据
    async fn get_field_datas(&self, session: &Session) -> AppResult<IndexMap<String, Value>>;
}