pub trait ConditionalStorage: ResourceStorage {
// Required methods
fn conditional_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalCreateResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn conditional_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
upsert: bool,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalUpdateResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn conditional_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalDeleteResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
// Provided method
fn conditional_patch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
patch: &'life4 PatchFormat,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalPatchResult>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
}Expand description
Extension trait for conditional operations based on search criteria.
Required Methods§
Sourcefn conditional_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalCreateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn conditional_create<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalCreateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Creates a resource only if no matching resource exists.
§Arguments
tenant- The tenant contextresource_type- The FHIR resource typeresource- The resource to createsearch_params- Search parameters to check for existing matchfhir_version- The FHIR specification version for this resource
§Returns
Created- If no match was found and resource was createdExists- If exactly one matching resource was foundMultipleMatches- If multiple matching resources were found (error)
Sourcefn conditional_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
upsert: bool,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalUpdateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn conditional_update<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
resource: Value,
search_params: &'life3 str,
upsert: bool,
fhir_version: FhirVersion,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalUpdateResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Updates a resource based on search criteria.
§Arguments
tenant- The tenant contextresource_type- The FHIR resource typeresource- The new resource contentsearch_params- Search parameters to find the resourceupsert- If true, create if no match foundfhir_version- The FHIR specification version for this resource (used if creating)
§Returns
Updated- If exactly one match was found and updatedCreated- If no match was found and upsert is trueNoMatch- If no match was found and upsert is falseMultipleMatches- If multiple matches were found (error)
Sourcefn conditional_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalDeleteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn conditional_delete<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalDeleteResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Deletes a resource based on search criteria.
§Arguments
tenant- The tenant contextresource_type- The FHIR resource typesearch_params- Search parameters to find the resource
§Returns
Deleted- If exactly one match was found and deletedNoMatch- If no match was foundMultipleMatches- If multiple matches were found (error)
Provided Methods§
Sourcefn conditional_patch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
patch: &'life4 PatchFormat,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalPatchResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn conditional_patch<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tenant: &'life1 TenantContext,
resource_type: &'life2 str,
search_params: &'life3 str,
patch: &'life4 PatchFormat,
) -> Pin<Box<dyn Future<Output = StorageResult<ConditionalPatchResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Patches a resource based on search criteria.
This implements conditional patch as defined in FHIR:
PATCH [base]/[type]?[search-params]
§Arguments
tenant- The tenant contextresource_type- The FHIR resource typesearch_params- Search parameters to find the resourcepatch- The patch to apply (JSON Patch, FHIRPath Patch, or Merge Patch)
§Returns
Patched- If exactly one match was found and patchedNoMatch- If no match was foundMultipleMatches- If multiple matches were found (error)
§Errors
StorageError::Validation- If the patch is invalid or would create invalid resourceStorageError::Backend(NotSupported)- If conditional patch is not supported