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

Fix executing a query with parameters #3

Merged
merged 1 commit into from
Nov 1, 2022

Conversation

TheEdgeOfRage
Copy link
Member

No description provided.

@@ -5,6 +5,10 @@ import (
"strings"
)

type ExecuteRequest struct {
QueryParameters map[string]string `json:"query_parameters,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map[string]any

should be any, I don't know of a better way of saying:
it is either string or a float64 or an integer, maybe @diegoximenes or @jmsgu know..

Copy link
Contributor

@diegoximenes diegoximenes Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For (int | string) this can be useful: https://pkg.go.dev/k8s.io/apimachinery/pkg/util/intstr#IntOrString.
I am not sure if with the generics support from go 1.18 something nice appeared related to this kind of issue, I haven't used generics on golang yet.
Regarding float, usually I discourage using it for types on API interfaces, unless it is really necessary, due to round trip issues.
Check a little about k8s APIs handling numbers with Quantity (https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) by the way: kubernetes-sigs/controller-tools#245

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to support float, since just restricting parameters to int is not really desirable. I'll make it any for now and we can see about using maybe only string in the future and doing a conversion on the duneapi side, or even QES

@TheEdgeOfRage TheEdgeOfRage merged commit 046bc64 into main Nov 1, 2022
@TheEdgeOfRage TheEdgeOfRage deleted the fix-parameter-executions branch November 1, 2022 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants