mirror of
https://github.com/OMGeeky/google_bigquery_v2.git
synced 2026-01-08 20:47:17 +01:00
implement empty client
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "google_bigquery_v2"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@@ -5,6 +5,7 @@ use google_bigquery2::hyper::client::HttpConnector;
|
||||
use google_bigquery2::hyper_rustls::HttpsConnector;
|
||||
use google_bigquery2::Bigquery;
|
||||
use google_bigquery2::{hyper, hyper_rustls, oauth2};
|
||||
use google_bigquery2::client::NoToken;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BigqueryClient {
|
||||
@@ -21,16 +22,26 @@ impl Default for BigqueryClient {
|
||||
|
||||
impl BigqueryClient {
|
||||
pub fn empty() -> BigqueryClient {
|
||||
todo!()
|
||||
let auth: NoToken = NoToken::default();
|
||||
let client = Bigquery::new(
|
||||
hyper::Client::builder().build(
|
||||
hyper_rustls::HttpsConnectorBuilder::new()
|
||||
.with_native_roots()
|
||||
.https_or_http()
|
||||
.enable_http1()
|
||||
.enable_http2()
|
||||
.build(),
|
||||
),
|
||||
auth,
|
||||
);
|
||||
BigqueryClient {
|
||||
client,
|
||||
project_id: "".to_string(),
|
||||
dataset_id: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: check if this unsafe impl is needed
|
||||
unsafe impl Send for BigqueryClient {}
|
||||
|
||||
//TODO: check if this unsafe impl is needed
|
||||
unsafe impl Sync for BigqueryClient {}
|
||||
|
||||
impl BigqueryClient {
|
||||
pub async fn new<S: Into<String>>(
|
||||
project_id: S,
|
||||
|
||||
@@ -217,6 +217,12 @@ async fn test_select_limit_1() {
|
||||
assert_eq!(q.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_empty_client(){
|
||||
let empty_client = BigqueryClient::empty();
|
||||
debug!("empty client: {:?}", empty_client);
|
||||
}
|
||||
|
||||
fn init_logger() {
|
||||
let global_level = LevelFilter::Info;
|
||||
let own_level = LevelFilter::Trace;
|
||||
|
||||
Reference in New Issue
Block a user