pub struct Db { /* private fields */ }Expand description
An immutable database value.
A Db names a snapshot to read from; Db::as_of, Db::since, and
Db::history derive new views cheaply. Every read method is async
because the remote backend may need a round trip; the local backend
resolves in-process.
Implementations§
Source§impl Db
impl Db
Sourcepub async fn query(
&self,
query: &Query,
args: Args,
) -> Result<QueryResult, ClientError>
pub async fn query( &self, query: &Query, args: Args, ) -> Result<QueryResult, ClientError>
Runs a typed Query with input arguments.
The receiver binds the query’s default $ source; additional
non-database :in inputs are supplied positionally by args.
§Errors
Returns ClientError for malformed queries or execution failures.
Sourcepub async fn query_edn(
&self,
query: Edn,
args: Vec<Edn>,
) -> Result<QueryResult, ClientError>
pub async fn query_edn( &self, query: Edn, args: Vec<Edn>, ) -> Result<QueryResult, ClientError>
Runs a raw boundary-Edn query with positional argument forms — an
escape hatch for queries not built through Query.
§Errors
Returns ClientError for malformed queries or execution failures.
Sourcepub async fn pull(
&self,
pattern: &Pull,
entity: impl IntoEdn,
) -> Result<Edn, ClientError>
pub async fn pull( &self, pattern: &Pull, entity: impl IntoEdn, ) -> Result<Edn, ClientError>
Pulls a typed Pull specification for one entity.
The entity is named by any IntoEdn value the boundary accepts: an
entity id (long), an ident keyword, or a lookup ref
(tx::lookup(...)).
§Errors
Returns ClientError for malformed patterns or unknown idents.
Sourcepub async fn datoms(
&self,
index: Index,
components: Vec<Edn>,
limit: usize,
) -> Result<Vec<DatomRow>, ClientError>
pub async fn datoms( &self, index: Index, components: Vec<Edn>, limit: usize, ) -> Result<Vec<DatomRow>, ClientError>
Scans datoms from a covering index, binding components as a leading
prefix in the index’s order.
§Errors
Returns ClientError on bad components or transport failure.
Sourcepub async fn stats(&self) -> Result<DbStats, ClientError>
pub async fn stats(&self) -> Result<DbStats, ClientError>
Sourcepub async fn basis_t(&self) -> Result<u64, ClientError>
pub async fn basis_t(&self) -> Result<u64, ClientError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Db
impl !UnwindSafe for Db
impl Freeze for Db
impl Send for Db
impl Sync for Db
impl Unpin for Db
impl UnsafeUnpin for Db
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request