google_cloud_bigquery/generated/query_metadata.rs
1// Copyright 2026 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21
22#[allow(missing_docs)]
23#[derive(Clone, Default, PartialEq)]
24#[non_exhaustive]
25pub struct QueryMetadata {
26 /// Whether the query result was fetched from the query cache.
27 pub cache_hit: std::option::Option<wkt::BoolValue>,
28
29 /// Required. Describes the job configuration.
30 pub configuration: std::option::Option<google_cloud_bigquery_v2::model::JobConfiguration>,
31
32 /// Output only. Creation time of this query, in milliseconds since the epoch.
33 /// This field will be present on all queries.
34 pub creation_time: std::option::Option<i64>,
35
36 /// Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE,
37 /// MERGE or TRUNCATE.
38 pub dml_stats: std::option::Option<google_cloud_bigquery_v2::model::DmlStats>,
39
40 /// Output only. End time of this query, in milliseconds since the epoch. This
41 /// field will be present whenever a query job is in the DONE state.
42 pub end_time: std::option::Option<i64>,
43
44 /// Output only. The first errors or warnings encountered during the running of
45 /// the job. The final message includes the number of errors that caused the
46 /// process to stop. Errors here do not necessarily mean that the job has
47 /// completed or was unsuccessful. For more information about error messages,
48 /// see [Error
49 /// messages](https://cloud.google.com/bigquery/docs/error-messages).
50 pub errors: std::vec::Vec<google_cloud_bigquery_v2::model::ErrorProto>,
51
52 /// Output only. A hash of this resource.
53 pub etag: std::string::String,
54
55 /// Output only. Opaque ID field of the job.
56 pub id: std::string::String,
57
58 /// Whether the query has completed or not. If rows or totalRows are present,
59 /// this will always be true. If this is false, totalRows will not be
60 /// available.
61 pub job_complete: std::option::Option<wkt::BoolValue>,
62
63 /// Output only. The reason why a Job was created.
64 pub job_creation_reason:
65 std::option::Option<google_cloud_bigquery_v2::model::JobCreationReason>,
66
67 /// Optional. Reference describing the unique-per-user name of the job.
68 pub job_reference: std::option::Option<google_cloud_bigquery_v2::model::JobReference>,
69
70 /// Output only. The type of the resource.
71 pub kind: std::string::String,
72
73 /// Output only. The geographic location of the query.
74 ///
75 /// For more information about BigQuery locations, see:
76 /// <https://cloud.google.com/bigquery/docs/locations>
77 pub location: std::string::String,
78
79 /// Output only. The number of rows affected by a DML statement. Present only
80 /// for DML statements INSERT, UPDATE or DELETE.
81 pub num_dml_affected_rows: std::option::Option<wkt::Int64Value>,
82
83 /// Output only. The number of rows out of `total_rows` returned in this
84 /// response.
85 ///
86 /// This feature is not yet available.
87 pub page_row_count: i64,
88
89 /// A token used for paging results. A non-empty token indicates that
90 /// additional results are available. To see additional results,
91 /// query the
92 /// [`jobs.getQueryResults`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults)
93 /// method. For more information, see [Paging through table
94 /// data](https://cloud.google.com/bigquery/docs/paging-results).
95 pub page_token: std::string::String,
96
97 /// Output only. [Full-projection-only] String representation of identity of
98 /// requesting party. Populated for both first- and third-party identities.
99 /// Only present for APIs that support third-party identities.
100 pub principal_subject: std::string::String,
101
102 /// Auto-generated ID for the query.
103 pub query_id: std::string::String,
104
105 /// The schema of the results. Present only when the query completes
106 /// successfully.
107 pub schema: std::option::Option<google_cloud_bigquery_v2::model::TableSchema>,
108
109 /// Output only. A URL that can be used to access the resource again.
110 pub self_link: std::string::String,
111
112 /// Output only. Information of the session if this job is part of one.
113 pub session_info: std::option::Option<google_cloud_bigquery_v2::model::SessionInfo>,
114
115 /// Output only. Start time of this query, in milliseconds since the epoch.
116 /// This field will be present when the query job transitions from the PENDING
117 /// state to either RUNNING or DONE.
118 pub start_time: std::option::Option<i64>,
119
120 /// Output only. The type of query statement, if valid.
121 /// Possible values:
122 ///
123 /// * `SELECT`:
124 /// [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list)
125 /// statement.
126 /// * `ASSERT`:
127 /// [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert)
128 /// statement.
129 /// * `INSERT`:
130 /// [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement)
131 /// statement.
132 /// * `UPDATE`:
133 /// [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#update_statement)
134 /// statement.
135 /// * `DELETE`:
136 /// [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
137 /// statement.
138 /// * `MERGE`:
139 /// [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language)
140 /// statement.
141 /// * `CREATE_TABLE`: [`CREATE
142 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
143 /// statement, without `AS SELECT`.
144 /// * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS
145 /// SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement)
146 /// statement.
147 /// * `CREATE_VIEW`: [`CREATE
148 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement)
149 /// statement.
150 /// * `CREATE_MODEL`: [`CREATE
151 /// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement)
152 /// statement.
153 /// * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED
154 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement)
155 /// statement.
156 /// * `CREATE_FUNCTION`: [`CREATE
157 /// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement)
158 /// statement.
159 /// * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE
160 /// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement)
161 /// statement.
162 /// * `CREATE_PROCEDURE`: [`CREATE
163 /// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure)
164 /// statement.
165 /// * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS
166 /// POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement)
167 /// statement.
168 /// * `CREATE_SCHEMA`: [`CREATE
169 /// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement)
170 /// statement.
171 /// * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT
172 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement)
173 /// statement.
174 /// * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH
175 /// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement)
176 /// statement.
177 /// * `DROP_TABLE`: [`DROP
178 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement)
179 /// statement.
180 /// * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL
181 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement)
182 /// statement.
183 /// * `DROP_VIEW`: [`DROP
184 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement)
185 /// statement.
186 /// * `DROP_MODEL`: [`DROP
187 /// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model)
188 /// statement.
189 /// * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED
190 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement)
191 /// statement.
192 /// * `DROP_FUNCTION` : [`DROP
193 /// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement)
194 /// statement.
195 /// * `DROP_TABLE_FUNCTION` : [`DROP TABLE
196 /// FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function)
197 /// statement.
198 /// * `DROP_PROCEDURE`: [`DROP
199 /// PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement)
200 /// statement.
201 /// * `DROP_SEARCH_INDEX`: [`DROP SEARCH
202 /// INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index)
203 /// statement.
204 /// * `DROP_SCHEMA`: [`DROP
205 /// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement)
206 /// statement.
207 /// * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT
208 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement)
209 /// statement.
210 /// * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS
211 /// POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement)
212 /// statement.
213 /// * `ALTER_TABLE`: [`ALTER
214 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement)
215 /// statement.
216 /// * `ALTER_VIEW`: [`ALTER
217 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement)
218 /// statement.
219 /// * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED
220 /// VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement)
221 /// statement.
222 /// * `ALTER_SCHEMA`: [`ALTER
223 /// SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_schema_set_options_statement)
224 /// statement.
225 /// * `SCRIPT`:
226 /// [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language).
227 /// * `TRUNCATE_TABLE`: [`TRUNCATE
228 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement)
229 /// statement.
230 /// * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL
231 /// TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement)
232 /// statement.
233 /// * `EXPORT_DATA`: [`EXPORT
234 /// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement)
235 /// statement.
236 /// * `EXPORT_MODEL`: [`EXPORT
237 /// MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model)
238 /// statement.
239 /// * `LOAD_DATA`: [`LOAD
240 /// DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement)
241 /// statement.
242 /// * `CALL`:
243 /// [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call)
244 /// statement.
245 pub statement_type: std::string::String,
246
247 /// Output only. Information about the job, including starting time and ending
248 /// time of the job.
249 pub statistics: std::option::Option<google_cloud_bigquery_v2::model::JobStatistics>,
250
251 /// Output only. The status of this job. Examine this value when polling an
252 /// asynchronous job to see if the job is complete.
253 pub status: std::option::Option<google_cloud_bigquery_v2::model::JobStatus>,
254
255 /// Output only. If the project is configured to use on-demand pricing,
256 /// then this field contains the total bytes billed for the job.
257 /// If the project is configured to use flat-rate pricing, then you are
258 /// not billed for bytes and this field is informational only.
259 pub total_bytes_billed: std::option::Option<i64>,
260
261 /// The total number of bytes processed for this query. If this query was a dry
262 /// run, this is the number of bytes that would be processed if the query were
263 /// run.
264 pub total_bytes_processed: std::option::Option<wkt::Int64Value>,
265
266 /// The total number of rows in the complete query result set, which can be
267 /// more than the number of rows in this single page of results.
268 pub total_rows: std::option::Option<wkt::UInt64Value>,
269
270 /// Output only. Number of slot ms the user is actually billed for.
271 pub total_slot_ms: std::option::Option<i64>,
272
273 /// Output only. Email address of the user who ran the job.
274 pub user_email: std::string::String,
275
276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
277}
278
279impl QueryMetadata {
280 /// Creates a new default instance.
281 pub fn new() -> Self {
282 std::default::Default::default()
283 }
284
285 /// Sets the value of [cache_hit][crate::model_ext::QueryMetadata::cache_hit].
286 pub fn set_cache_hit<T>(mut self, v: T) -> Self
287 where
288 T: std::convert::Into<wkt::BoolValue>,
289 {
290 self.cache_hit = std::option::Option::Some(v.into());
291 self
292 }
293
294 /// Sets or clears the value of [cache_hit][crate::model_ext::QueryMetadata::cache_hit].
295 pub fn set_or_clear_cache_hit<T>(mut self, v: std::option::Option<T>) -> Self
296 where
297 T: std::convert::Into<wkt::BoolValue>,
298 {
299 self.cache_hit = v.map(|x| x.into());
300 self
301 }
302
303 /// Sets the value of [configuration][crate::model_ext::QueryMetadata::configuration].
304 pub fn set_configuration<T>(mut self, v: T) -> Self
305 where
306 T: std::convert::Into<google_cloud_bigquery_v2::model::JobConfiguration>,
307 {
308 self.configuration = std::option::Option::Some(v.into());
309 self
310 }
311
312 /// Sets or clears the value of [configuration][crate::model_ext::QueryMetadata::configuration].
313 pub fn set_or_clear_configuration<T>(mut self, v: std::option::Option<T>) -> Self
314 where
315 T: std::convert::Into<google_cloud_bigquery_v2::model::JobConfiguration>,
316 {
317 self.configuration = v.map(|x| x.into());
318 self
319 }
320
321 /// Sets the value of [creation_time][crate::model_ext::QueryMetadata::creation_time].
322 pub fn set_creation_time<T>(mut self, v: T) -> Self
323 where
324 T: std::convert::Into<i64>,
325 {
326 self.creation_time = std::option::Option::Some(v.into());
327 self
328 }
329
330 /// Sets or clears the value of [creation_time][crate::model_ext::QueryMetadata::creation_time].
331 pub fn set_or_clear_creation_time<T>(mut self, v: std::option::Option<T>) -> Self
332 where
333 T: std::convert::Into<i64>,
334 {
335 self.creation_time = v.map(|x| x.into());
336 self
337 }
338
339 /// Sets the value of [dml_stats][crate::model_ext::QueryMetadata::dml_stats].
340 pub fn set_dml_stats<T>(mut self, v: T) -> Self
341 where
342 T: std::convert::Into<google_cloud_bigquery_v2::model::DmlStats>,
343 {
344 self.dml_stats = std::option::Option::Some(v.into());
345 self
346 }
347
348 /// Sets or clears the value of [dml_stats][crate::model_ext::QueryMetadata::dml_stats].
349 pub fn set_or_clear_dml_stats<T>(mut self, v: std::option::Option<T>) -> Self
350 where
351 T: std::convert::Into<google_cloud_bigquery_v2::model::DmlStats>,
352 {
353 self.dml_stats = v.map(|x| x.into());
354 self
355 }
356
357 /// Sets the value of [end_time][crate::model_ext::QueryMetadata::end_time].
358 pub fn set_end_time<T>(mut self, v: T) -> Self
359 where
360 T: std::convert::Into<i64>,
361 {
362 self.end_time = std::option::Option::Some(v.into());
363 self
364 }
365
366 /// Sets or clears the value of [end_time][crate::model_ext::QueryMetadata::end_time].
367 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
368 where
369 T: std::convert::Into<i64>,
370 {
371 self.end_time = v.map(|x| x.into());
372 self
373 }
374
375 /// Sets the value of [errors][crate::model_ext::QueryMetadata::errors].
376 pub fn set_errors<T, V>(mut self, v: T) -> Self
377 where
378 T: std::iter::IntoIterator<Item = V>,
379 V: std::convert::Into<google_cloud_bigquery_v2::model::ErrorProto>,
380 {
381 use std::iter::Iterator;
382 self.errors = v.into_iter().map(|i| i.into()).collect();
383 self
384 }
385
386 /// Sets the value of [etag][crate::model_ext::QueryMetadata::etag].
387 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
388 self.etag = v.into();
389 self
390 }
391
392 /// Sets the value of [id][crate::model_ext::QueryMetadata::id].
393 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
394 self.id = v.into();
395 self
396 }
397
398 /// Sets the value of [job_complete][crate::model_ext::QueryMetadata::job_complete].
399 pub fn set_job_complete<T>(mut self, v: T) -> Self
400 where
401 T: std::convert::Into<wkt::BoolValue>,
402 {
403 self.job_complete = std::option::Option::Some(v.into());
404 self
405 }
406
407 /// Sets or clears the value of [job_complete][crate::model_ext::QueryMetadata::job_complete].
408 pub fn set_or_clear_job_complete<T>(mut self, v: std::option::Option<T>) -> Self
409 where
410 T: std::convert::Into<wkt::BoolValue>,
411 {
412 self.job_complete = v.map(|x| x.into());
413 self
414 }
415
416 /// Sets the value of [job_creation_reason][crate::model_ext::QueryMetadata::job_creation_reason].
417 pub fn set_job_creation_reason<T>(mut self, v: T) -> Self
418 where
419 T: std::convert::Into<google_cloud_bigquery_v2::model::JobCreationReason>,
420 {
421 self.job_creation_reason = std::option::Option::Some(v.into());
422 self
423 }
424
425 /// Sets or clears the value of [job_creation_reason][crate::model_ext::QueryMetadata::job_creation_reason].
426 pub fn set_or_clear_job_creation_reason<T>(mut self, v: std::option::Option<T>) -> Self
427 where
428 T: std::convert::Into<google_cloud_bigquery_v2::model::JobCreationReason>,
429 {
430 self.job_creation_reason = v.map(|x| x.into());
431 self
432 }
433
434 /// Sets the value of [job_reference][crate::model_ext::QueryMetadata::job_reference].
435 pub fn set_job_reference<T>(mut self, v: T) -> Self
436 where
437 T: std::convert::Into<google_cloud_bigquery_v2::model::JobReference>,
438 {
439 self.job_reference = std::option::Option::Some(v.into());
440 self
441 }
442
443 /// Sets or clears the value of [job_reference][crate::model_ext::QueryMetadata::job_reference].
444 pub fn set_or_clear_job_reference<T>(mut self, v: std::option::Option<T>) -> Self
445 where
446 T: std::convert::Into<google_cloud_bigquery_v2::model::JobReference>,
447 {
448 self.job_reference = v.map(|x| x.into());
449 self
450 }
451
452 /// Sets the value of [kind][crate::model_ext::QueryMetadata::kind].
453 pub fn set_kind<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
454 self.kind = v.into();
455 self
456 }
457
458 /// Sets the value of [location][crate::model_ext::QueryMetadata::location].
459 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
460 self.location = v.into();
461 self
462 }
463
464 /// Sets the value of [num_dml_affected_rows][crate::model_ext::QueryMetadata::num_dml_affected_rows].
465 pub fn set_num_dml_affected_rows<T>(mut self, v: T) -> Self
466 where
467 T: std::convert::Into<wkt::Int64Value>,
468 {
469 self.num_dml_affected_rows = std::option::Option::Some(v.into());
470 self
471 }
472
473 /// Sets or clears the value of [num_dml_affected_rows][crate::model_ext::QueryMetadata::num_dml_affected_rows].
474 pub fn set_or_clear_num_dml_affected_rows<T>(mut self, v: std::option::Option<T>) -> Self
475 where
476 T: std::convert::Into<wkt::Int64Value>,
477 {
478 self.num_dml_affected_rows = v.map(|x| x.into());
479 self
480 }
481
482 /// Sets the value of [page_row_count][crate::model_ext::QueryMetadata::page_row_count].
483 pub fn set_page_row_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
484 self.page_row_count = v.into();
485 self
486 }
487
488 /// Sets the value of [page_token][crate::model_ext::QueryMetadata::page_token].
489 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
490 self.page_token = v.into();
491 self
492 }
493
494 /// Sets the value of [principal_subject][crate::model_ext::QueryMetadata::principal_subject].
495 pub fn set_principal_subject<T: std::convert::Into<std::string::String>>(
496 mut self,
497 v: T,
498 ) -> Self {
499 self.principal_subject = v.into();
500 self
501 }
502
503 /// Sets the value of [query_id][crate::model_ext::QueryMetadata::query_id].
504 pub fn set_query_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
505 self.query_id = v.into();
506 self
507 }
508
509 /// Sets the value of [schema][crate::model_ext::QueryMetadata::schema].
510 pub fn set_schema<T>(mut self, v: T) -> Self
511 where
512 T: std::convert::Into<google_cloud_bigquery_v2::model::TableSchema>,
513 {
514 self.schema = std::option::Option::Some(v.into());
515 self
516 }
517
518 /// Sets or clears the value of [schema][crate::model_ext::QueryMetadata::schema].
519 pub fn set_or_clear_schema<T>(mut self, v: std::option::Option<T>) -> Self
520 where
521 T: std::convert::Into<google_cloud_bigquery_v2::model::TableSchema>,
522 {
523 self.schema = v.map(|x| x.into());
524 self
525 }
526
527 /// Sets the value of [self_link][crate::model_ext::QueryMetadata::self_link].
528 pub fn set_self_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
529 self.self_link = v.into();
530 self
531 }
532
533 /// Sets the value of [session_info][crate::model_ext::QueryMetadata::session_info].
534 pub fn set_session_info<T>(mut self, v: T) -> Self
535 where
536 T: std::convert::Into<google_cloud_bigquery_v2::model::SessionInfo>,
537 {
538 self.session_info = std::option::Option::Some(v.into());
539 self
540 }
541
542 /// Sets or clears the value of [session_info][crate::model_ext::QueryMetadata::session_info].
543 pub fn set_or_clear_session_info<T>(mut self, v: std::option::Option<T>) -> Self
544 where
545 T: std::convert::Into<google_cloud_bigquery_v2::model::SessionInfo>,
546 {
547 self.session_info = v.map(|x| x.into());
548 self
549 }
550
551 /// Sets the value of [start_time][crate::model_ext::QueryMetadata::start_time].
552 pub fn set_start_time<T>(mut self, v: T) -> Self
553 where
554 T: std::convert::Into<i64>,
555 {
556 self.start_time = std::option::Option::Some(v.into());
557 self
558 }
559
560 /// Sets or clears the value of [start_time][crate::model_ext::QueryMetadata::start_time].
561 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
562 where
563 T: std::convert::Into<i64>,
564 {
565 self.start_time = v.map(|x| x.into());
566 self
567 }
568
569 /// Sets the value of [statement_type][crate::model_ext::QueryMetadata::statement_type].
570 pub fn set_statement_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
571 self.statement_type = v.into();
572 self
573 }
574
575 /// Sets the value of [statistics][crate::model_ext::QueryMetadata::statistics].
576 pub fn set_statistics<T>(mut self, v: T) -> Self
577 where
578 T: std::convert::Into<google_cloud_bigquery_v2::model::JobStatistics>,
579 {
580 self.statistics = std::option::Option::Some(v.into());
581 self
582 }
583
584 /// Sets or clears the value of [statistics][crate::model_ext::QueryMetadata::statistics].
585 pub fn set_or_clear_statistics<T>(mut self, v: std::option::Option<T>) -> Self
586 where
587 T: std::convert::Into<google_cloud_bigquery_v2::model::JobStatistics>,
588 {
589 self.statistics = v.map(|x| x.into());
590 self
591 }
592
593 /// Sets the value of [status][crate::model_ext::QueryMetadata::status].
594 pub fn set_status<T>(mut self, v: T) -> Self
595 where
596 T: std::convert::Into<google_cloud_bigquery_v2::model::JobStatus>,
597 {
598 self.status = std::option::Option::Some(v.into());
599 self
600 }
601
602 /// Sets or clears the value of [status][crate::model_ext::QueryMetadata::status].
603 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
604 where
605 T: std::convert::Into<google_cloud_bigquery_v2::model::JobStatus>,
606 {
607 self.status = v.map(|x| x.into());
608 self
609 }
610
611 /// Sets the value of [total_bytes_billed][crate::model_ext::QueryMetadata::total_bytes_billed].
612 pub fn set_total_bytes_billed<T>(mut self, v: T) -> Self
613 where
614 T: std::convert::Into<i64>,
615 {
616 self.total_bytes_billed = std::option::Option::Some(v.into());
617 self
618 }
619
620 /// Sets or clears the value of [total_bytes_billed][crate::model_ext::QueryMetadata::total_bytes_billed].
621 pub fn set_or_clear_total_bytes_billed<T>(mut self, v: std::option::Option<T>) -> Self
622 where
623 T: std::convert::Into<i64>,
624 {
625 self.total_bytes_billed = v.map(|x| x.into());
626 self
627 }
628
629 /// Sets the value of [total_bytes_processed][crate::model_ext::QueryMetadata::total_bytes_processed].
630 pub fn set_total_bytes_processed<T>(mut self, v: T) -> Self
631 where
632 T: std::convert::Into<wkt::Int64Value>,
633 {
634 self.total_bytes_processed = std::option::Option::Some(v.into());
635 self
636 }
637
638 /// Sets or clears the value of [total_bytes_processed][crate::model_ext::QueryMetadata::total_bytes_processed].
639 pub fn set_or_clear_total_bytes_processed<T>(mut self, v: std::option::Option<T>) -> Self
640 where
641 T: std::convert::Into<wkt::Int64Value>,
642 {
643 self.total_bytes_processed = v.map(|x| x.into());
644 self
645 }
646
647 /// Sets the value of [total_rows][crate::model_ext::QueryMetadata::total_rows].
648 pub fn set_total_rows<T>(mut self, v: T) -> Self
649 where
650 T: std::convert::Into<wkt::UInt64Value>,
651 {
652 self.total_rows = std::option::Option::Some(v.into());
653 self
654 }
655
656 /// Sets or clears the value of [total_rows][crate::model_ext::QueryMetadata::total_rows].
657 pub fn set_or_clear_total_rows<T>(mut self, v: std::option::Option<T>) -> Self
658 where
659 T: std::convert::Into<wkt::UInt64Value>,
660 {
661 self.total_rows = v.map(|x| x.into());
662 self
663 }
664
665 /// Sets the value of [total_slot_ms][crate::model_ext::QueryMetadata::total_slot_ms].
666 pub fn set_total_slot_ms<T>(mut self, v: T) -> Self
667 where
668 T: std::convert::Into<i64>,
669 {
670 self.total_slot_ms = std::option::Option::Some(v.into());
671 self
672 }
673
674 /// Sets or clears the value of [total_slot_ms][crate::model_ext::QueryMetadata::total_slot_ms].
675 pub fn set_or_clear_total_slot_ms<T>(mut self, v: std::option::Option<T>) -> Self
676 where
677 T: std::convert::Into<i64>,
678 {
679 self.total_slot_ms = v.map(|x| x.into());
680 self
681 }
682
683 /// Sets the value of [user_email][crate::model_ext::QueryMetadata::user_email].
684 pub fn set_user_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
685 self.user_email = v.into();
686 self
687 }
688}
689
690mod debug {
691
692 impl std::fmt::Debug for super::QueryMetadata {
693 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
694 let mut debug_struct = f.debug_struct("QueryMetadata");
695 debug_struct.field("cache_hit", &self.cache_hit);
696 debug_struct.field("configuration", &self.configuration);
697 debug_struct.field("creation_time", &self.creation_time);
698 debug_struct.field("dml_stats", &self.dml_stats);
699 debug_struct.field("end_time", &self.end_time);
700 debug_struct.field("errors", &self.errors);
701 debug_struct.field("etag", &self.etag);
702 debug_struct.field("id", &self.id);
703 debug_struct.field("job_complete", &self.job_complete);
704 debug_struct.field("job_creation_reason", &self.job_creation_reason);
705 debug_struct.field("job_reference", &self.job_reference);
706 debug_struct.field("kind", &self.kind);
707 debug_struct.field("location", &self.location);
708 debug_struct.field("num_dml_affected_rows", &self.num_dml_affected_rows);
709 debug_struct.field("page_row_count", &self.page_row_count);
710 debug_struct.field("page_token", &self.page_token);
711 debug_struct.field("principal_subject", &self.principal_subject);
712 debug_struct.field("query_id", &self.query_id);
713 debug_struct.field("schema", &self.schema);
714 debug_struct.field("self_link", &self.self_link);
715 debug_struct.field("session_info", &self.session_info);
716 debug_struct.field("start_time", &self.start_time);
717 debug_struct.field("statement_type", &self.statement_type);
718 debug_struct.field("statistics", &self.statistics);
719 debug_struct.field("status", &self.status);
720 debug_struct.field("total_bytes_billed", &self.total_bytes_billed);
721 debug_struct.field("total_bytes_processed", &self.total_bytes_processed);
722 debug_struct.field("total_rows", &self.total_rows);
723 debug_struct.field("total_slot_ms", &self.total_slot_ms);
724 debug_struct.field("user_email", &self.user_email);
725 if !self._unknown_fields.is_empty() {
726 debug_struct.field("_unknown_fields", &self._unknown_fields);
727 }
728 debug_struct.finish()
729 }
730 }
731}
732
733impl std::convert::From<google_cloud_bigquery_v2::model::Job> for QueryMetadata {
734 fn from(resp: google_cloud_bigquery_v2::model::Job) -> Self {
735 Self {
736 configuration: resp.configuration,
737 etag: resp.etag,
738 id: resp.id,
739 job_creation_reason: resp.job_creation_reason,
740 job_reference: resp.job_reference,
741 kind: resp.kind,
742 principal_subject: resp.principal_subject,
743 self_link: resp.self_link,
744 statistics: resp.statistics,
745 status: resp.status,
746 user_email: resp.user_email,
747 ..Default::default()
748 }
749 }
750}
751
752impl std::convert::From<google_cloud_bigquery_v2::model::QueryResponse> for QueryMetadata {
753 fn from(resp: google_cloud_bigquery_v2::model::QueryResponse) -> Self {
754 Self {
755 cache_hit: resp.cache_hit,
756 creation_time: resp.creation_time,
757 dml_stats: resp.dml_stats,
758 end_time: resp.end_time,
759 errors: resp.errors,
760 job_complete: resp.job_complete,
761 job_creation_reason: resp.job_creation_reason,
762 job_reference: resp.job_reference,
763 kind: resp.kind,
764 location: resp.location,
765 num_dml_affected_rows: resp.num_dml_affected_rows,
766 page_row_count: resp.page_row_count,
767 page_token: resp.page_token,
768 query_id: resp.query_id,
769 schema: resp.schema,
770 session_info: resp.session_info,
771 start_time: resp.start_time,
772 statement_type: resp.statement_type,
773 total_bytes_billed: resp.total_bytes_billed,
774 total_bytes_processed: resp.total_bytes_processed,
775 total_rows: resp.total_rows,
776 total_slot_ms: resp.total_slot_ms,
777 ..Default::default()
778 }
779 }
780}
781
782impl std::convert::From<QueryMetadata> for crate::generated::CompleteQueryMetadata {
783 fn from(md: QueryMetadata) -> Self {
784 crate::generated::CompleteQueryMetadata {
785 cache_hit: md.cache_hit,
786 creation_time: md.creation_time,
787 dml_stats: md.dml_stats,
788 end_time: md.end_time,
789 errors: md.errors,
790 job_complete: md.job_complete,
791 job_creation_reason: md.job_creation_reason,
792 job_reference: md.job_reference,
793 kind: md.kind,
794 location: md.location,
795 num_dml_affected_rows: md.num_dml_affected_rows,
796 page_row_count: md.page_row_count,
797 page_token: md.page_token,
798 query_id: md.query_id,
799 schema: md.schema,
800 session_info: md.session_info,
801 start_time: md.start_time,
802 statement_type: md.statement_type,
803 total_bytes_billed: md.total_bytes_billed,
804 total_bytes_processed: md.total_bytes_processed,
805 total_rows: md.total_rows,
806 total_slot_ms: md.total_slot_ms,
807 ..Default::default()
808 }
809 }
810}