pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
pub fn new(adapters: HashMap<String, Arc<dyn Adapter + Send + Sync>>) -> Self
Sourcepub fn adapter_for(&self, model_name: &str) -> Result<Arc<dyn Adapter>>
pub fn adapter_for(&self, model_name: &str) -> Result<Arc<dyn Adapter>>
Returns an instance of the adapter for the given model name
Sourcepub async fn create_record<M>(&self, model: &M) -> Result<M>where
M: ResourceObject,
pub async fn create_record<M>(&self, model: &M) -> Result<M>where
M: ResourceObject,
Create a new record in the current store
Sourcepub async fn delete_record<M>(&self, model: &M) -> Result<()>where
M: ResourceObject,
pub async fn delete_record<M>(&self, model: &M) -> Result<()>where
M: ResourceObject,
Delete a record
Sourcepub async fn find_all<M>(
&self,
resource_type: &str,
_options: Option<FindAllOptions>,
) -> Result<Vec<M>>where
M: ResourceObject,
pub async fn find_all<M>(
&self,
resource_type: &str,
_options: Option<FindAllOptions>,
) -> Result<Vec<M>>where
M: ResourceObject,
Find all the records for the given resource type
Sourcepub async fn find_record<M>(
&self,
resource_type: &str,
id: &str,
_options: Option<FindOptions>,
) -> Result<M>where
M: ResourceObject,
pub async fn find_record<M>(
&self,
resource_type: &str,
id: &str,
_options: Option<FindOptions>,
) -> Result<M>where
M: ResourceObject,
Find a single record
Sourcepub fn peek_record<M>(&self, resource_type: &str, id: &str) -> Result<Option<M>>where
M: ResourceObject,
pub fn peek_record<M>(&self, resource_type: &str, id: &str) -> Result<Option<M>>where
M: ResourceObject,
Check for a single record without triggering a fetch
Sourcepub fn push<M>(&mut self, model: M) -> Result<()>where
M: ResourceObject,
pub fn push<M>(&mut self, model: M) -> Result<()>where
M: ResourceObject,
Push a model into the store
Sourcepub async fn query<M>(
&self,
resource_type: &str,
query: Value,
) -> Result<Vec<M>>where
M: ResourceObject,
pub async fn query<M>(
&self,
resource_type: &str,
query: Value,
) -> Result<Vec<M>>where
M: ResourceObject,
Delegate a query to the adapter
Sourcepub async fn query_record<M>(
&self,
resource_type: &str,
query: Value,
options: Option<QueryRecordOptions>,
) -> Result<Option<M>>where
M: ResourceObject,
pub async fn query_record<M>(
&self,
resource_type: &str,
query: Value,
options: Option<QueryRecordOptions>,
) -> Result<Option<M>>where
M: ResourceObject,
Delegate the request for a single record to the adapter
Sourcepub fn unload_all(&mut self, resource_type: &str) -> Result<()>
pub fn unload_all(&mut self, resource_type: &str) -> Result<()>
Unloads all records in the store for the given resource type
Sourcepub fn unload_record<M>(&mut self, model: &M) -> Result<()>where
M: ResourceObject,
pub fn unload_record<M>(&mut self, model: &M) -> Result<()>where
M: ResourceObject,
Unload a single record from the store
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Store
impl !UnwindSafe for Store
impl Freeze for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more