lquerel / gcp-bigquery-client

GCP BigQuery Client (Rust)
Apache License 2.0
92 stars 60 forks source link

Question about using the QueryParameter #7

Closed Plommonsorbet closed 2 years ago

Plommonsorbet commented 2 years ago

Hey!

Originally posted this in the dicsussion forum but realized it might not have been the right place to post this in, so creating an issue instead:

Thanks for creating this library, I'm really happy to be able to use rust for working with bigquery data!

I have a question about using the query parameter option:

Looking through the docs I've found that there is the option QueryParameter however it requires you to declare a QueryParameterType which I'm not quite clear on how to do.

Looking at the code snippet for the QueryParameterType, I'm understanding this as a recursive type since there is no Option around array_type, I know this is normally fine because of the Box but I don't understand how to opt out of this without an option or some other kind of enum or break point.

pub struct QueryParameterType {
    pub array_type: Box<QueryParameterType>,
    pub struct_types: Option<Vec<QueryParameterTypeStructTypes>>,
    pub type: String,
}

Maybe there is some trick I don't know with Box to not make it infinitely recursive? Would love to just get a short code snippet of how to define a simple parameter type like a string or int if that would be possible?

lquerel commented 2 years ago

Hi - This is indeed an issue in my code generator. I will fix that as soon as possible.

lquerel commented 2 years ago

Could you provide a description of your use case? I'd like to create a test for that.

nixxholas commented 2 years ago

@Plommonsorbet Bump!

lquerel commented 2 years ago

Fixed in 0.11.0

lquerel commented 2 years ago

0.11.0