pub struct PgMetadataConnection { /* private fields */ }Expand description
Direct PostgreSQL metadata connection.
Implementations§
Source§impl PgMetadataConnection
impl PgMetadataConnection
Sourcepub fn observe_error(&self, error: &PgMetaError)
pub fn observe_error(&self, error: &PgMetaError)
Retains only the first typed failure for the operation’s bounded summary. Mapping an adapter error to a public workflow error must retain this evidence.
Sourcepub fn connection_description(&self) -> &str
pub fn connection_description(&self) -> &str
Returns the connection description safe for logs and diagnostics.
Sourcepub fn health_check(&mut self) -> Result<PgHealth, PgMetaError>
pub fn health_check(&mut self) -> Result<PgHealth, PgMetaError>
Performs a lightweight database and schema-bootstrap health check.
§Errors
Returns an error if either PostgreSQL query fails.
Sourcepub fn bootstrap_schema(&mut self) -> Result<SchemaBootstrapReport, PgMetaError>
pub fn bootstrap_schema(&mut self) -> Result<SchemaBootstrapReport, PgMetaError>
Creates or verifies the metadata schema inside one transaction.
§Errors
Returns an error if the transaction cannot be opened or committed, the migration table cannot be updated, or the bootstrap SQL fails.
Sourcepub fn with_metadata_transaction<T, F>(
&mut self,
f: F,
) -> Result<T, PgMetaError>
pub fn with_metadata_transaction<T, F>( &mut self, f: F, ) -> Result<T, PgMetaError>
Runs caller-supplied work inside a PostgreSQL transaction.
§Errors
Returns an error if the transaction cannot be opened or committed, or if the callback returns an error.
Source§impl PgMetadataConnection
impl PgMetadataConnection
pub fn missing_metadata_tables( &mut self, ) -> Result<Vec<&'static str>, PgMetaError>
pub fn list_study_types( &mut self, ) -> Result<Vec<PgStudyTypeReadModel>, PgMetaError>
pub fn list_studies(&mut self) -> Result<Vec<PgStudyReadModel>, PgMetaError>
Sourcepub fn list_studies_for_domain(
&mut self,
domain_id: DomainId,
) -> Result<Vec<PgStudyReadModel>, PgMetaError>
pub fn list_studies_for_domain( &mut self, domain_id: DomainId, ) -> Result<Vec<PgStudyReadModel>, PgMetaError>
Lists Studies explicitly linked to domain_id through study_domains.
Dataset and Variable relationships are intentionally absent from this
authority query.
pub fn get_study( &mut self, study_id: StudyId, ) -> Result<Option<PgStudyReadModel>, PgMetaError>
pub fn get_study_by_name( &mut self, name: &str, ) -> Result<Option<PgStudyReadModel>, PgMetaError>
pub fn list_domains(&mut self) -> Result<Vec<PgDomainReadModel>, PgMetaError>
pub fn list_domains_by_name( &mut self, name: &str, ) -> Result<Vec<PgDomainReadModel>, PgMetaError>
pub fn get_domain( &mut self, domain_id: DomainId, ) -> Result<Option<PgDomainReadModel>, PgMetaError>
pub fn get_domain_by_name( &mut self, name: &str, ) -> Result<Option<PgDomainReadModel>, PgMetaError>
pub fn list_duo_codes(&mut self) -> Result<Vec<PgDuoCodeReadModel>, PgMetaError>
pub fn list_study_domains( &mut self, study_id: StudyId, ) -> Result<Vec<PgDomainReadModel>, PgMetaError>
pub fn list_study_domain_links( &mut self, study_id: StudyId, ) -> Result<Vec<PgStudyDomainReadModel>, PgMetaError>
pub fn list_study_access( &mut self, study_id: StudyId, ) -> Result<Vec<PgStudyAccessReadModel>, PgMetaError>
pub fn list_study_custodians( &mut self, study_id: StudyId, ) -> Result<Vec<PgStudyCustodianReadModel>, PgMetaError>
pub fn list_study_duo_restrictions( &mut self, study_id: StudyId, ) -> Result<Vec<PgDuoRestrictionReadModel>, PgMetaError>
pub fn list_assets_for_study( &mut self, study_id: StudyId, ) -> Result<Vec<PgAssetReadModel>, PgMetaError>
pub fn get_asset( &mut self, asset_id: AssetId, ) -> Result<Option<PgAssetReadModel>, PgMetaError>
pub fn get_asset_by_name( &mut self, study_id: StudyId, name: &str, ) -> Result<Option<PgAssetReadModel>, PgMetaError>
pub fn list_asset_versions( &mut self, asset_id: AssetId, ) -> Result<Vec<PgAssetVersionReadModel>, PgMetaError>
pub fn get_asset_version( &mut self, version_id: VersionId, ) -> Result<Option<PgAssetVersionReadModel>, PgMetaError>
pub fn list_asset_version_duo_restrictions( &mut self, version_id: VersionId, ) -> Result<Vec<PgAssetVersionDuoRestrictionReadModel>, PgMetaError>
pub fn list_datasets_for_asset( &mut self, asset_id: AssetId, ) -> Result<Vec<PgDatasetReadModel>, PgMetaError>
pub fn get_dataset( &mut self, dataset_id: VersionId, ) -> Result<Option<PgDatasetReadModel>, PgMetaError>
Sourcepub fn get_dataset_version_withdrawn_at(
&mut self,
dataset_id: VersionId,
) -> Result<Option<DateTime<Utc>>, PgMetaError>
pub fn get_dataset_version_withdrawn_at( &mut self, dataset_id: VersionId, ) -> Result<Option<DateTime<Utc>>, PgMetaError>
Returns the authoritative withdrawal timestamp for one Dataset version.
pub fn list_datafiles_for_asset( &mut self, asset_id: AssetId, ) -> Result<Vec<PgDataFileReadModel>, PgMetaError>
pub fn get_datafile( &mut self, datafile_id: VersionId, ) -> Result<Option<PgDataFileReadModel>, PgMetaError>
pub fn list_value_types( &mut self, ) -> Result<Vec<PgValueTypeReadModel>, PgMetaError>
pub fn list_vocabularies_for_domain( &mut self, domain_id: DomainId, ) -> Result<Vec<PgVocabularyReadModel>, PgMetaError>
pub fn get_vocabulary( &mut self, vocabulary_id: VocabularyId, ) -> Result<Option<PgVocabularyReadModel>, PgMetaError>
pub fn list_vocabulary_items( &mut self, vocabulary_id: VocabularyId, ) -> Result<Vec<PgVocabularyItemReadModel>, PgMetaError>
pub fn get_vocabulary_item( &mut self, vocabulary_item_id: VocabularyItemId, ) -> Result<Option<PgVocabularyItemReadModel>, PgMetaError>
pub fn list_vocabulary_mappings( &mut self, ) -> Result<Vec<PgVocabularyMappingReadModel>, PgMetaError>
pub fn list_vocabulary_mappings_for_vocabulary( &mut self, vocabulary_id: VocabularyId, ) -> Result<Vec<PgVocabularyMappingWithItemsReadModel>, PgMetaError>
pub fn list_variables_for_domain( &mut self, domain_id: DomainId, ) -> Result<Vec<PgVariableReadModel>, PgMetaError>
pub fn get_variable( &mut self, variable_id: VariableId, ) -> Result<Option<PgVariableReadModel>, PgMetaError>
Sourcepub fn list_variable_mappings_provisional(
&mut self,
) -> Result<Vec<PgVariableMappingReadModel>, PgMetaError>
pub fn list_variable_mappings_provisional( &mut self, ) -> Result<Vec<PgVariableMappingReadModel>, PgMetaError>
Provisional read path for a future public.variable_mapping table.
Callers should first verify that the target schema actually contains this table.