pub struct FirestoreClient { /* private fields */ }Implementations§
Source§impl FirestoreClient
impl FirestoreClient
Sourcepub fn new(firestore: Firestore, datastore: Arc<dyn Datastore>) -> Self
pub fn new(firestore: Firestore, datastore: Arc<dyn Datastore>) -> Self
Creates a client backed by the supplied datastore implementation.
Sourcepub fn with_in_memory(firestore: Firestore) -> Self
pub fn with_in_memory(firestore: Firestore) -> Self
Returns a client that stores documents in memory only.
Useful for tests or demos where persistence/network access is not required.
Sourcepub fn with_http_datastore(firestore: Firestore) -> FirestoreResult<Self>
pub fn with_http_datastore(firestore: Firestore) -> FirestoreResult<Self>
Builds a client that talks to Firestore over the REST endpoints using anonymous credentials.
Sourcepub fn with_http_datastore_authenticated(
firestore: Firestore,
auth_provider: TokenProviderArc,
app_check_provider: Option<TokenProviderArc>,
) -> FirestoreResult<Self>
pub fn with_http_datastore_authenticated( firestore: Firestore, auth_provider: TokenProviderArc, app_check_provider: Option<TokenProviderArc>, ) -> FirestoreResult<Self>
Builds an HTTP-backed client that attaches the provided Auth/App Check providers to every request.
Pass None for app_check_provider when App Check is not configured.
Sourcepub fn get_doc(&self, path: &str) -> FirestoreResult<DocumentSnapshot>
pub fn get_doc(&self, path: &str) -> FirestoreResult<DocumentSnapshot>
Fetches the document located at path.
Returns a snapshot that may or may not contain data depending on whether the document exists.
Sourcepub fn set_doc(
&self,
path: &str,
data: BTreeMap<String, FirestoreValue>,
options: Option<SetOptions>,
) -> FirestoreResult<()>
pub fn set_doc( &self, path: &str, data: BTreeMap<String, FirestoreValue>, options: Option<SetOptions>, ) -> FirestoreResult<()>
Writes the provided map of fields into the document at path.
options.merge == true mirrors the JS API but is currently unsupported
for the HTTP datastore.
Sourcepub fn add_doc(
&self,
collection_path: &str,
data: BTreeMap<String, FirestoreValue>,
) -> FirestoreResult<DocumentSnapshot>
pub fn add_doc( &self, collection_path: &str, data: BTreeMap<String, FirestoreValue>, ) -> FirestoreResult<DocumentSnapshot>
Adds a new document to the collection located at collection_path and
returns the resulting snapshot.
Sourcepub fn get_doc_with_converter<C>(
&self,
reference: &ConvertedDocumentReference<C>,
) -> FirestoreResult<TypedDocumentSnapshot<C>>where
C: FirestoreDataConverter,
pub fn get_doc_with_converter<C>(
&self,
reference: &ConvertedDocumentReference<C>,
) -> FirestoreResult<TypedDocumentSnapshot<C>>where
C: FirestoreDataConverter,
Reads a document using the converter attached to a typed reference.
Sourcepub fn get_docs(&self, query: &Query) -> FirestoreResult<QuerySnapshot>
pub fn get_docs(&self, query: &Query) -> FirestoreResult<QuerySnapshot>
Executes the provided query and returns its results.
Sourcepub fn get_docs_with_converter<C>(
&self,
query: &ConvertedQuery<C>,
) -> FirestoreResult<TypedQuerySnapshot<C>>where
C: FirestoreDataConverter,
pub fn get_docs_with_converter<C>(
&self,
query: &ConvertedQuery<C>,
) -> FirestoreResult<TypedQuerySnapshot<C>>where
C: FirestoreDataConverter,
Executes a converted query, producing typed snapshots.
Sourcepub fn set_doc_with_converter<C>(
&self,
reference: &ConvertedDocumentReference<C>,
data: C::Model,
options: Option<SetOptions>,
) -> FirestoreResult<()>where
C: FirestoreDataConverter,
pub fn set_doc_with_converter<C>(
&self,
reference: &ConvertedDocumentReference<C>,
data: C::Model,
options: Option<SetOptions>,
) -> FirestoreResult<()>where
C: FirestoreDataConverter,
Writes a typed model to the location referenced by reference.
Sourcepub fn add_doc_with_converter<C>(
&self,
collection: &ConvertedCollectionReference<C>,
data: C::Model,
) -> FirestoreResult<TypedDocumentSnapshot<C>>where
C: FirestoreDataConverter,
pub fn add_doc_with_converter<C>(
&self,
collection: &ConvertedCollectionReference<C>,
data: C::Model,
) -> FirestoreResult<TypedDocumentSnapshot<C>>where
C: FirestoreDataConverter,
Creates a document with auto-generated ID using the provided converter.
Trait Implementations§
Source§impl Clone for FirestoreClient
impl Clone for FirestoreClient
Source§fn clone(&self) -> FirestoreClient
fn clone(&self) -> FirestoreClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more