text-document-common 1.4.1

Shared entities, database, events, and undo/redo infrastructure for text-document
Documentation
// Generated by Qleany v1.7.3 from repository_factory.tera

pub mod write {

    use crate::{
        database::transactions::Transaction,
        direct_access::{
            block::{block_repository::BlockRepository, block_table::BlockHashMapTable},
            document::{
                document_repository::DocumentRepository, document_table::DocumentHashMapTable,
            },
            frame::{frame_repository::FrameRepository, frame_table::FrameHashMapTable},
            inline_element::{
                inline_element_repository::InlineElementRepository,
                inline_element_table::InlineElementHashMapTable,
            },
            list::{list_repository::ListRepository, list_table::ListHashMapTable},
            resource::{
                resource_repository::ResourceRepository, resource_table::ResourceHashMapTable,
            },
            root::{root_repository::RootRepository, root_table::RootHashMapTable},
            table::{table_repository::TableRepository, table_table::TableHashMapTable},
            table_cell::{
                table_cell_repository::TableCellRepository, table_cell_table::TableCellHashMapTable,
            },
        },
    };
    use anyhow::Result;

    pub fn create_root_repository(transaction: &'_ Transaction) -> Result<RootRepository<'_>> {
        let root_table = RootHashMapTable::new(transaction.get_store());
        Ok(RootRepository::new(Box::new(root_table), transaction))
    }

    pub fn create_document_repository(
        transaction: &'_ Transaction,
    ) -> Result<DocumentRepository<'_>> {
        let document_table = DocumentHashMapTable::new(transaction.get_store());
        Ok(DocumentRepository::new(
            Box::new(document_table),
            transaction,
        ))
    }

    pub fn create_frame_repository(transaction: &'_ Transaction) -> Result<FrameRepository<'_>> {
        let frame_table = FrameHashMapTable::new(transaction.get_store());
        Ok(FrameRepository::new(Box::new(frame_table), transaction))
    }

    pub fn create_block_repository(transaction: &'_ Transaction) -> Result<BlockRepository<'_>> {
        let block_table = BlockHashMapTable::new(transaction.get_store());
        Ok(BlockRepository::new(Box::new(block_table), transaction))
    }

    pub fn create_inline_element_repository(
        transaction: &'_ Transaction,
    ) -> Result<InlineElementRepository<'_>> {
        let inline_element_table = InlineElementHashMapTable::new(transaction.get_store());
        Ok(InlineElementRepository::new(
            Box::new(inline_element_table),
            transaction,
        ))
    }

    pub fn create_list_repository(transaction: &'_ Transaction) -> Result<ListRepository<'_>> {
        let list_table = ListHashMapTable::new(transaction.get_store());
        Ok(ListRepository::new(Box::new(list_table), transaction))
    }

    pub fn create_resource_repository(
        transaction: &'_ Transaction,
    ) -> Result<ResourceRepository<'_>> {
        let resource_table = ResourceHashMapTable::new(transaction.get_store());
        Ok(ResourceRepository::new(
            Box::new(resource_table),
            transaction,
        ))
    }

    pub fn create_table_repository(transaction: &'_ Transaction) -> Result<TableRepository<'_>> {
        let table_table = TableHashMapTable::new(transaction.get_store());
        Ok(TableRepository::new(Box::new(table_table), transaction))
    }

    pub fn create_table_cell_repository(
        transaction: &'_ Transaction,
    ) -> Result<TableCellRepository<'_>> {
        let table_cell_table = TableCellHashMapTable::new(transaction.get_store());
        Ok(TableCellRepository::new(
            Box::new(table_cell_table),
            transaction,
        ))
    }
}

pub mod read {
    use crate::{
        database::transactions::Transaction,
        direct_access::{
            block::{block_repository::BlockRepositoryRO, block_table::BlockHashMapTableRO},
            document::{
                document_repository::DocumentRepositoryRO, document_table::DocumentHashMapTableRO,
            },
            frame::{frame_repository::FrameRepositoryRO, frame_table::FrameHashMapTableRO},
            inline_element::{
                inline_element_repository::InlineElementRepositoryRO,
                inline_element_table::InlineElementHashMapTableRO,
            },
            list::{list_repository::ListRepositoryRO, list_table::ListHashMapTableRO},
            resource::{
                resource_repository::ResourceRepositoryRO, resource_table::ResourceHashMapTableRO,
            },
            root::{root_repository::RootRepositoryRO, root_table::RootHashMapTableRO},
            table::{table_repository::TableRepositoryRO, table_table::TableHashMapTableRO},
            table_cell::{
                table_cell_repository::TableCellRepositoryRO,
                table_cell_table::TableCellHashMapTableRO,
            },
        },
    };
    use anyhow::Result;

    pub fn create_root_repository(transaction: &'_ Transaction) -> Result<RootRepositoryRO<'_>> {
        let root_table = RootHashMapTableRO::new(transaction.get_store());
        Ok(RootRepositoryRO::new(Box::new(root_table)))
    }

    pub fn create_document_repository(
        transaction: &'_ Transaction,
    ) -> Result<DocumentRepositoryRO<'_>> {
        let document_table = DocumentHashMapTableRO::new(transaction.get_store());
        Ok(DocumentRepositoryRO::new(Box::new(document_table)))
    }

    pub fn create_frame_repository(transaction: &'_ Transaction) -> Result<FrameRepositoryRO<'_>> {
        let frame_table = FrameHashMapTableRO::new(transaction.get_store());
        Ok(FrameRepositoryRO::new(Box::new(frame_table)))
    }

    pub fn create_block_repository(transaction: &'_ Transaction) -> Result<BlockRepositoryRO<'_>> {
        let block_table = BlockHashMapTableRO::new(transaction.get_store());
        Ok(BlockRepositoryRO::new(Box::new(block_table)))
    }

    pub fn create_inline_element_repository(
        transaction: &'_ Transaction,
    ) -> Result<InlineElementRepositoryRO<'_>> {
        let inline_element_table = InlineElementHashMapTableRO::new(transaction.get_store());
        Ok(InlineElementRepositoryRO::new(Box::new(
            inline_element_table,
        )))
    }

    pub fn create_list_repository(transaction: &'_ Transaction) -> Result<ListRepositoryRO<'_>> {
        let list_table = ListHashMapTableRO::new(transaction.get_store());
        Ok(ListRepositoryRO::new(Box::new(list_table)))
    }

    pub fn create_resource_repository(
        transaction: &'_ Transaction,
    ) -> Result<ResourceRepositoryRO<'_>> {
        let resource_table = ResourceHashMapTableRO::new(transaction.get_store());
        Ok(ResourceRepositoryRO::new(Box::new(resource_table)))
    }

    pub fn create_table_repository(transaction: &'_ Transaction) -> Result<TableRepositoryRO<'_>> {
        let table_table = TableHashMapTableRO::new(transaction.get_store());
        Ok(TableRepositoryRO::new(Box::new(table_table)))
    }

    pub fn create_table_cell_repository(
        transaction: &'_ Transaction,
    ) -> Result<TableCellRepositoryRO<'_>> {
        let table_cell_table = TableCellHashMapTableRO::new(transaction.get_store());
        Ok(TableCellRepositoryRO::new(Box::new(table_cell_table)))
    }
}