bigquery_client/gcloud/bigquery/
mod.rs1use super::GCloudFactory;
2
3pub mod table;
4
5pub use table::Table;
6
7pub type CrudResult<T> = Result<T, Box<dyn std::error::Error>>;
8
9
10pub struct BigQueryClient {
11 gcloud_factory: Box<GCloudFactory>,
12 project_id: String,
13}
14
15impl BigQueryClient {
16
17 pub fn new(gcloud_factory: Box<GCloudFactory>, project_id: &str) -> BigQueryClient {
18
19 BigQueryClient{
20 gcloud_factory: gcloud_factory,
21 project_id: project_id.to_owned(),
22 }
23 }
24
25 pub fn table(&self, dataset_id: &str, name: &str) -> Table {
26 let gcloud = (self.gcloud_factory)();
27 Table::new(gcloud, self.project_id.as_str(), dataset_id, name)
28 }
29
30}