Struct qldb::QueryBuilder
source · [−]pub struct QueryBuilder { /* private fields */ }Expand description
Represents the query being built. It allows to add parameters and to execute the query.
Implementations
sourceimpl QueryBuilder
impl QueryBuilder
sourcepub fn param<P: Into<IonValue> + Clone>(self, param: P) -> Self
pub fn param<P: Into<IonValue> + Clone>(self, param: P) -> Self
Adds a param to the query. Params in PartiQL are deoned by
the character ?. For example, the query:
SELECT * FROM Autos WHERE id = ? AND model = ?
will need 2 calls to this method. The first will refer to
the first ? and the second to the second ?.
sourcepub async fn execute(self) -> QldbResult<DocumentCollection>
pub async fn execute(self) -> QldbResult<DocumentCollection>
Executes the query in QLDBwith the parameter provided by
the param method. It will return a Vector of Ion Values,
one for each document returned.
This method will automatically load all the pages. It may require to make several HTTP calls to the QLDB Ledger as each Page contains no more than 200 documents.
It consumes the QueryBuilder in the process.
sourcepub fn get_cursor(self) -> QldbResult<Cursor>
pub fn get_cursor(self) -> QldbResult<Cursor>
Creates a cursor for this query, allowing to load values page by page. Each page in QLDB contains 200 documents.
sourcepub async fn count(self) -> QldbResult<i64>
pub async fn count(self) -> QldbResult<i64>
Sends a query to QLDB that returns a count. Keep in mind that there isn’t any filter to fail is another kind of statement is given.
Be careful with COUNT statements as they “block” the whole table and other transactions affecting the same table will return an OCC error when committed.
If you want to make a simple count, it is better to use the count method from Client::count
It consumes the QueryBuilder in the process.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for QueryBuilder
impl Send for QueryBuilder
impl Sync for QueryBuilder
impl Unpin for QueryBuilder
impl !UnwindSafe for QueryBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more