pub struct CompleteQuery { /* private fields */ }Expand description
A handle representing a successfully completed query ready for reading results.
Query::until_done() returns a CompleteQuery.
This handle provides access to cached execution metadata, schema
definitions, and a row iterator via read().
§Example
let complete = client
.query("SELECT 'done' AS status")
.until_done()
.await?;
println!("Cache hit: {:?}", complete.metadata().cache_hit);Implementations§
Source§impl CompleteQuery
impl CompleteQuery
Sourcepub fn read(self) -> RowIterator
pub fn read(self) -> RowIterator
Read the result set of the query.
§Example
let mut rows = client
.query("SELECT 100 AS score")
.until_done()
.await?
.read();
while let Some(row) = rows.next().await.transpose()? {
let score: i64 = row.get("score");
println!("Score: {score}");
}Sourcepub fn metadata(&self) -> &CompleteQueryMetadata
pub fn metadata(&self) -> &CompleteQueryMetadata
Returns a reference to the cached summary metadata for this query.
The returned CompleteQueryMetadata contains
summary statistics such as total rows, schema details, cache hit
indicators, and estimated bytes processed without making additional
RPCs.
§Example
let completed = client
.query("SELECT 'metadata_check'")
.until_done()
.await?;
let meta = completed.metadata();
println!("Total rows: {:?}", meta.total_rows);Sourcepub fn get_job(&self) -> Option<GetJob>
pub fn get_job(&self) -> Option<GetJob>
Build a request to fetch full Job execution metadata from the service for this query.
Returns
Noneif the query was executed without creating a job (for example, when usingJobCreationMode::JobCreationOptional, or when the query was a dry run).
§Example
let completed = client
.query("SELECT 1")
.set_job_creation_mode(JobCreationMode::JobCreationRequired) // Forces a job to be created
.until_done()
.await?;
match completed.get_job() {
Some(req) => {
let job_info = req.send().await?;
println!("Executed by user: {}", job_info.user_email);
}
None => {
println!(
"Query was run without creating a job. Query ID: {}",
completed.metadata().query_id
);
}
}Trait Implementations§
Source§impl Clone for CompleteQuery
impl Clone for CompleteQuery
Source§fn clone(&self) -> CompleteQuery
fn clone(&self) -> CompleteQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CompleteQuery
impl !UnwindSafe for CompleteQuery
impl Freeze for CompleteQuery
impl Send for CompleteQuery
impl Sync for CompleteQuery
impl Unpin for CompleteQuery
impl UnsafeUnpin for CompleteQuery
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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