Skip to main content

PGConnection

Enum PGConnection 

Source
pub enum PGConnection {
    Pool(Pool<Postgres>, Cache<VersionId, Resource>),
    Transaction(Arc<Mutex<Transaction<'static, Postgres>>>, Cache<VersionId, Resource>),
}
Expand description

Connection types supported by the repository traits.

Variants§

§

Pool(Pool<Postgres>, Cache<VersionId, Resource>)

§

Transaction(Arc<Mutex<Transaction<'static, Postgres>>>, Cache<VersionId, Resource>)

Implementations§

Source§

impl PGConnection

Source

pub fn pool(pool: Pool<Postgres>) -> Self

Source

pub fn cache(&self) -> &Cache<VersionId, Resource>

Trait Implementations§

Source§

impl Clone for PGConnection

Source§

fn clone(&self) -> PGConnection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PGConnection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FHIRRepository for PGConnection

Source§

async fn create( &self, tenant: &TenantId, project: &ProjectId, author: &UserTokenClaims, fhir_version: &SupportedFHIRVersions, resource: &mut Resource, ) -> Result<Resource, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, project: &ProjectId, author: &UserTokenClaims, fhir_version: &SupportedFHIRVersions, resource: &mut Resource, id: &str, ) -> Result<Resource, OperationOutcomeError>

Source§

async fn update( &self, tenant: &TenantId, project: &ProjectId, author: &UserTokenClaims, fhir_version: &SupportedFHIRVersions, resource: &mut Resource, id: &str, ) -> Result<Resource, OperationOutcomeError>

Source§

async fn read_by_version_ids( &self, tenant_id: &TenantId, project_id: &ProjectId, version_ids: &[&VersionId], cache_policy: CachePolicy, ) -> Result<Vec<Resource>, OperationOutcomeError>

Source§

async fn read_latest( &self, tenant_id: &TenantId, project_id: &ProjectId, resource_type: &ResourceType, resource_id: &ResourceId, ) -> Result<Option<Resource>, OperationOutcomeError>

Source§

async fn history( &self, tenant_id: &TenantId, project_id: &ProjectId, request: &HistoryRequest, ) -> Result<Vec<ResourceHistoryValue>, OperationOutcomeError>

Source§

fn in_transaction(&self) -> bool

Source§

async fn transaction<'a>( &'a self, is_updating_sequence: bool, ) -> Result<Self, OperationOutcomeError>

Source§

async fn commit(self) -> Result<(), OperationOutcomeError>

Source§

async fn rollback(self) -> Result<(), OperationOutcomeError>

Source§

impl Login for PGConnection

Source§

async fn login( &self, tenant: &TenantId, method: &LoginMethod, ) -> Result<LoginResult, OperationOutcomeError>

Source§

impl Migrate for PGConnection

Source§

async fn migrate(&self) -> Result<(), OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> ProjectAuthAdmin<CreateAuthorizationCode, AuthorizationCode, AuthorizationCodeSearchClaims, AuthorizationCode, Key> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, project: &ProjectId, authorization_code: CreateAuthorizationCode, ) -> Result<AuthorizationCode, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, project: &ProjectId, code: &Key, ) -> Result<Option<AuthorizationCode>, OperationOutcomeError>

Source§

async fn update( &self, _tenant: &TenantId, _project: &ProjectId, _model: AuthorizationCode, ) -> Result<AuthorizationCode, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, project: &ProjectId, code: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, project: &ProjectId, clauses: &AuthorizationCodeSearchClaims, ) -> Result<Vec<AuthorizationCode>, OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> ProjectAuthAdmin<CreateMembership, Membership, MembershipSearchClaims, Membership, Key> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, project: &ProjectId, new_membership: CreateMembership, ) -> Result<Membership, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, project: &ProjectId, id: &Key, ) -> Result<Option<Membership>, OperationOutcomeError>

Source§

async fn update( &self, tenant: &TenantId, project: &ProjectId, model: Membership, ) -> Result<Membership, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, project: &ProjectId, id: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, project: &ProjectId, clauses: &MembershipSearchClaims, ) -> Result<Vec<Membership>, OperationOutcomeError>

Source§

impl ProjectAuthAdmin<CreateScope, Scope, ScopeSearchClaims, UpdateScope, ScopeKey> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, project: &ProjectId, new_scope: CreateScope, ) -> Result<Scope, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, project: &ProjectId, key: &ScopeKey, ) -> Result<Option<Scope>, OperationOutcomeError>

Source§

async fn update( &self, tenant: &TenantId, project: &ProjectId, model: UpdateScope, ) -> Result<Scope, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, project: &ProjectId, key: &ScopeKey, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, project: &ProjectId, clauses: &ScopeSearchClaims, ) -> Result<Vec<Scope>, OperationOutcomeError>

Source§

impl RateLimit for PGConnection

Source§

fn check<'a>( &'a self, rate_key: &'a str, max: i32, points: i32, window_in_seconds: i32, ) -> Pin<Box<dyn Future<Output = Result<i32, RateLimitError>> + Send + 'a>>

Returns the current points after the operation. Note use of box and pin so can satisfy dynamic dispatch requirements.

Source§

impl Repository for PGConnection

Source§

impl ResourceSequential for PGConnection

Source§

async fn get_sequence( &self, tenant_id: &TenantId, sequence_id: u64, count: Option<u64>, ) -> Result<Vec<ResourcePollingValue>, OperationOutcomeError>

Source§

impl SystemAdmin<User, UserSearchClauses> for PGConnection

Source§

async fn search( &self, clauses: &UserSearchClauses, ) -> Result<Vec<User>, OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> TenantAuthAdmin<CreateAuthorizationCode, AuthorizationCode, AuthorizationCodeSearchClaims, AuthorizationCode, Key> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, authorization_code: CreateAuthorizationCode, ) -> Result<AuthorizationCode, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, code: &Key, ) -> Result<Option<AuthorizationCode>, OperationOutcomeError>

Source§

async fn update( &self, _tenant: &TenantId, _model: AuthorizationCode, ) -> Result<AuthorizationCode, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, code: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, clauses: &AuthorizationCodeSearchClaims, ) -> Result<Vec<AuthorizationCode>, OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> TenantAuthAdmin<CreateProject, Project, ProjectSearchClaims, Project, Key> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, new_project: CreateProject, ) -> Result<Project, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, id: &Key, ) -> Result<Option<Project>, OperationOutcomeError>

Source§

async fn update( &self, tenant: &TenantId, model: Project, ) -> Result<Project, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, id: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, claims: &ProjectSearchClaims, ) -> Result<Vec<Project>, OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> TenantAuthAdmin<CreateTenant, Tenant, TenantSearchClaims, Tenant, Key> for PGConnection

Source§

async fn create( &self, _tenant: &TenantId, new_tenant: CreateTenant, ) -> Result<Tenant, OperationOutcomeError>

Source§

async fn read( &self, _tenant: &TenantId, id: &Key, ) -> Result<Option<Tenant>, OperationOutcomeError>

Source§

async fn update( &self, _tenant: &TenantId, model: Tenant, ) -> Result<Tenant, OperationOutcomeError>

Source§

async fn delete( &self, _tenant: &TenantId, id: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, _tenant: &TenantId, claims: &TenantSearchClaims, ) -> Result<Vec<Tenant>, OperationOutcomeError>

Source§

impl<Key: AsRef<str> + Send + Sync> TenantAuthAdmin<CreateUser, User, UserSearchClauses, UpdateUser, Key> for PGConnection

Source§

async fn create( &self, tenant: &TenantId, new_user: CreateUser, ) -> Result<User, OperationOutcomeError>

Source§

async fn read( &self, tenant: &TenantId, id: &Key, ) -> Result<Option<User>, OperationOutcomeError>

Source§

async fn update( &self, tenant: &TenantId, user: UpdateUser, ) -> Result<User, OperationOutcomeError>

Source§

async fn delete( &self, tenant: &TenantId, id: &Key, ) -> Result<(), OperationOutcomeError>

Source§

async fn search( &self, tenant: &TenantId, clauses: &UserSearchClauses, ) -> Result<Vec<User>, OperationOutcomeError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more