pub mod write {
use crate::{
database::transactions::Transaction,
direct_access::{
dto::{dto_repository::DtoRepository, dto_table::DtoHashMapTable},
dto_field::{
dto_field_repository::DtoFieldRepository, dto_field_table::DtoFieldHashMapTable,
},
entity::{entity_repository::EntityRepository, entity_table::EntityHashMapTable},
feature::{feature_repository::FeatureRepository, feature_table::FeatureHashMapTable},
field::{field_repository::FieldRepository, field_table::FieldHashMapTable},
file::{file_repository::FileRepository, file_table::FileHashMapTable},
global::{global_repository::GlobalRepository, global_table::GlobalHashMapTable},
relationship::{
relationship_repository::RelationshipRepository,
relationship_table::RelationshipHashMapTable,
},
root::{root_repository::RootRepository, root_table::RootHashMapTable},
system::{system_repository::SystemRepository, system_table::SystemHashMapTable},
use_case::{
use_case_repository::UseCaseRepository, use_case_table::UseCaseHashMapTable,
},
user_interface::{
user_interface_repository::UserInterfaceRepository,
user_interface_table::UserInterfaceHashMapTable,
},
workspace::{
workspace_repository::WorkspaceRepository, workspace_table::WorkspaceHashMapTable,
},
},
};
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_workspace_repository(
transaction: &'_ Transaction,
) -> Result<WorkspaceRepository<'_>> {
let workspace_table = WorkspaceHashMapTable::new(transaction.get_store());
Ok(WorkspaceRepository::new(
Box::new(workspace_table),
transaction,
))
}
pub fn create_system_repository(transaction: &'_ Transaction) -> Result<SystemRepository<'_>> {
let system_table = SystemHashMapTable::new(transaction.get_store());
Ok(SystemRepository::new(Box::new(system_table), transaction))
}
pub fn create_entity_repository(transaction: &'_ Transaction) -> Result<EntityRepository<'_>> {
let entity_table = EntityHashMapTable::new(transaction.get_store());
Ok(EntityRepository::new(Box::new(entity_table), transaction))
}
pub fn create_field_repository(transaction: &'_ Transaction) -> Result<FieldRepository<'_>> {
let field_table = FieldHashMapTable::new(transaction.get_store());
Ok(FieldRepository::new(Box::new(field_table), transaction))
}
pub fn create_feature_repository(
transaction: &'_ Transaction,
) -> Result<FeatureRepository<'_>> {
let feature_table = FeatureHashMapTable::new(transaction.get_store());
Ok(FeatureRepository::new(Box::new(feature_table), transaction))
}
pub fn create_file_repository(transaction: &'_ Transaction) -> Result<FileRepository<'_>> {
let file_table = FileHashMapTable::new(transaction.get_store());
Ok(FileRepository::new(Box::new(file_table), transaction))
}
pub fn create_use_case_repository(
transaction: &'_ Transaction,
) -> Result<UseCaseRepository<'_>> {
let use_case_table = UseCaseHashMapTable::new(transaction.get_store());
Ok(UseCaseRepository::new(
Box::new(use_case_table),
transaction,
))
}
pub fn create_dto_repository(transaction: &'_ Transaction) -> Result<DtoRepository<'_>> {
let dto_table = DtoHashMapTable::new(transaction.get_store());
Ok(DtoRepository::new(Box::new(dto_table), transaction))
}
pub fn create_dto_field_repository(
transaction: &'_ Transaction,
) -> Result<DtoFieldRepository<'_>> {
let dto_field_table = DtoFieldHashMapTable::new(transaction.get_store());
Ok(DtoFieldRepository::new(
Box::new(dto_field_table),
transaction,
))
}
pub fn create_global_repository(transaction: &'_ Transaction) -> Result<GlobalRepository<'_>> {
let global_table = GlobalHashMapTable::new(transaction.get_store());
Ok(GlobalRepository::new(Box::new(global_table), transaction))
}
pub fn create_relationship_repository(
transaction: &'_ Transaction,
) -> Result<RelationshipRepository<'_>> {
let relationship_table = RelationshipHashMapTable::new(transaction.get_store());
Ok(RelationshipRepository::new(
Box::new(relationship_table),
transaction,
))
}
pub fn create_user_interface_repository(
transaction: &'_ Transaction,
) -> Result<UserInterfaceRepository<'_>> {
let user_interface_table = UserInterfaceHashMapTable::new(transaction.get_store());
Ok(UserInterfaceRepository::new(
Box::new(user_interface_table),
transaction,
))
}
}
pub mod read {
use crate::{
database::transactions::Transaction,
direct_access::{
dto::{dto_repository::DtoRepositoryRO, dto_table::DtoHashMapTableRO},
dto_field::{
dto_field_repository::DtoFieldRepositoryRO, dto_field_table::DtoFieldHashMapTableRO,
},
entity::{entity_repository::EntityRepositoryRO, entity_table::EntityHashMapTableRO},
feature::{
feature_repository::FeatureRepositoryRO, feature_table::FeatureHashMapTableRO,
},
field::{field_repository::FieldRepositoryRO, field_table::FieldHashMapTableRO},
file::{file_repository::FileRepositoryRO, file_table::FileHashMapTableRO},
global::{global_repository::GlobalRepositoryRO, global_table::GlobalHashMapTableRO},
relationship::{
relationship_repository::RelationshipRepositoryRO,
relationship_table::RelationshipHashMapTableRO,
},
root::{root_repository::RootRepositoryRO, root_table::RootHashMapTableRO},
system::{system_repository::SystemRepositoryRO, system_table::SystemHashMapTableRO},
use_case::{
use_case_repository::UseCaseRepositoryRO, use_case_table::UseCaseHashMapTableRO,
},
user_interface::{
user_interface_repository::UserInterfaceRepositoryRO,
user_interface_table::UserInterfaceHashMapTableRO,
},
workspace::{
workspace_repository::WorkspaceRepositoryRO,
workspace_table::WorkspaceHashMapTableRO,
},
},
};
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_workspace_repository(
transaction: &'_ Transaction,
) -> Result<WorkspaceRepositoryRO<'_>> {
let workspace_table = WorkspaceHashMapTableRO::new(transaction.get_store());
Ok(WorkspaceRepositoryRO::new(Box::new(workspace_table)))
}
pub fn create_system_repository(
transaction: &'_ Transaction,
) -> Result<SystemRepositoryRO<'_>> {
let system_table = SystemHashMapTableRO::new(transaction.get_store());
Ok(SystemRepositoryRO::new(Box::new(system_table)))
}
pub fn create_entity_repository(
transaction: &'_ Transaction,
) -> Result<EntityRepositoryRO<'_>> {
let entity_table = EntityHashMapTableRO::new(transaction.get_store());
Ok(EntityRepositoryRO::new(Box::new(entity_table)))
}
pub fn create_field_repository(transaction: &'_ Transaction) -> Result<FieldRepositoryRO<'_>> {
let field_table = FieldHashMapTableRO::new(transaction.get_store());
Ok(FieldRepositoryRO::new(Box::new(field_table)))
}
pub fn create_feature_repository(
transaction: &'_ Transaction,
) -> Result<FeatureRepositoryRO<'_>> {
let feature_table = FeatureHashMapTableRO::new(transaction.get_store());
Ok(FeatureRepositoryRO::new(Box::new(feature_table)))
}
pub fn create_file_repository(transaction: &'_ Transaction) -> Result<FileRepositoryRO<'_>> {
let file_table = FileHashMapTableRO::new(transaction.get_store());
Ok(FileRepositoryRO::new(Box::new(file_table)))
}
pub fn create_use_case_repository(
transaction: &'_ Transaction,
) -> Result<UseCaseRepositoryRO<'_>> {
let use_case_table = UseCaseHashMapTableRO::new(transaction.get_store());
Ok(UseCaseRepositoryRO::new(Box::new(use_case_table)))
}
pub fn create_dto_repository(transaction: &'_ Transaction) -> Result<DtoRepositoryRO<'_>> {
let dto_table = DtoHashMapTableRO::new(transaction.get_store());
Ok(DtoRepositoryRO::new(Box::new(dto_table)))
}
pub fn create_dto_field_repository(
transaction: &'_ Transaction,
) -> Result<DtoFieldRepositoryRO<'_>> {
let dto_field_table = DtoFieldHashMapTableRO::new(transaction.get_store());
Ok(DtoFieldRepositoryRO::new(Box::new(dto_field_table)))
}
pub fn create_global_repository(
transaction: &'_ Transaction,
) -> Result<GlobalRepositoryRO<'_>> {
let global_table = GlobalHashMapTableRO::new(transaction.get_store());
Ok(GlobalRepositoryRO::new(Box::new(global_table)))
}
pub fn create_relationship_repository(
transaction: &'_ Transaction,
) -> Result<RelationshipRepositoryRO<'_>> {
let relationship_table = RelationshipHashMapTableRO::new(transaction.get_store());
Ok(RelationshipRepositoryRO::new(Box::new(relationship_table)))
}
pub fn create_user_interface_repository(
transaction: &'_ Transaction,
) -> Result<UserInterfaceRepositoryRO<'_>> {
let user_interface_table = UserInterfaceHashMapTableRO::new(transaction.get_store());
Ok(UserInterfaceRepositoryRO::new(Box::new(
user_interface_table,
)))
}
}