[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigquery: support constraints.Integer for QueryParameter #8662

Open
derekperkins opened this issue Oct 9, 2023 · 0 comments
Open

bigquery: support constraints.Integer for QueryParameter #8662

derekperkins opened this issue Oct 9, 2023 · 0 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@derekperkins
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When passing in a slice of query params, if you have a typed integer (in my case now a proto enum), BigQuery rejects the query as invalid for an Int64 field. e.g.

type IntType int32

bigquery.QueryParam{
	Name: "int_filter",
	Value: []IntType{1, 2, 3}
}

Describe the solution you'd like
Now that generics are out and available in all supported Go versions, it should be trivial to transparently support variations with constraints.Integer. If you wanted to be extra careful, you could write your own version of the constraint to exclude uint64 to prevent truly unsupported values through.

Describe alternatives you've considered
We're manually converting slices ourselves now.

func toInt64Slice[E constraints.Integer](s []E) []int64 {
	vals := make([]int64, len(s))
	for i, v := range s {
		vals[i] = int64(v)
	}
	return vals
}
@derekperkins derekperkins added the triage me I really want to be triaged. label Oct 9, 2023
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the BigQuery API. label Oct 9, 2023
@alvarowolfx alvarowolfx added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants
@shollyman @alvarowolfx @derekperkins and others