Skip to main content

SqliteStore

Struct SqliteStore 

Source
pub struct SqliteStore { /* private fields */ }
Expand description

An openEHR repository in a SQLite database.

§Foreign keys are switched on explicitly

SQLite disables foreign-key enforcement by default, per connection, for backward compatibility. A store that did not enable it would accept a version pointing at a container that does not exist — and would do so silently, which is worse than not having the constraint, because the schema says it is there.

Implementations§

Source§

impl SqliteStore

Source

pub fn in_memory() -> Result<Self>

Opens an in-memory database.

§Errors

Returns StoreError::Engine if SQLite cannot be opened or configured.

Source

pub fn open(path: &Path) -> Result<Self>

Opens a database file, creating it if absent.

§Errors

Returns StoreError::Engine if the file cannot be opened.

Source

pub fn from_connection(connection: Connection) -> Result<Self>

Wraps an existing connection.

§Errors

Returns StoreError::Engine if the connection cannot be configured.

Source

pub fn connection(&self) -> &Connection

The underlying connection, for callers that need a query this trait does not offer.

Trait Implementations§

Source§

impl Store for SqliteStore

Source§

fn engine(&self) -> &'static str

Which engine backs this store, for error messages.
Source§

fn install(&mut self) -> Result<()>

Installs the schema. Read more
Source§

fn create_ehr(&mut self, ehr: &Ehr) -> Result<()>

Creates an EHR. Read more
Source§

fn get_ehr(&self, ehr_id: &HierObjectId) -> Result<Ehr>

Reads an EHR. Read more
Source§

fn create_contribution( &mut self, ehr_id: &HierObjectId, contribution: &Contribution, ) -> Result<()>

Records a contribution. Read more
Source§

fn commit_composition( &mut self, ehr_id: &HierObjectId, version: &Version<Composition>, contribution_uid: &str, ) -> Result<CommitOutcome>

Commits one version of a composition. Read more
Source§

fn get_version(&self, uid: &ObjectVersionId) -> Result<VersionRow>

Reads one version by identifier. Read more
Source§

fn latest_version( &self, versioned_object_uid: &HierObjectId, ) -> Result<VersionRow>

The latest version of a container. Read more
Source§

fn version_at_time( &self, versioned_object_uid: &HierObjectId, at: &DvDateTime, ) -> Result<VersionRow>

The version current at a given time. Read more
Source§

fn all_versions( &self, versioned_object_uid: &HierObjectId, ) -> Result<Vec<VersionRow>>

Every version of a container, oldest first. Read more
Source§

fn chain_checkpoint( &self, versioned_object_uid: &HierObjectId, ) -> Result<String>

A checkpoint over a container’s chain, for an external witness. Read more
Source§

fn find_compositions_by_archetype( &self, ehr_id: &HierObjectId, archetype_id: &str, ) -> Result<Vec<CompositionIndexRow>>

Compositions in a record whose archetype matches. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.