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

feat: pass params to influx 3.0 in Flight query client #55

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions influxdb3/query.go
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ func (c *Client) initializeQueryClient() error {
// - A custom iterator (*QueryIterator).
// - An error, if any.
func (c *Client) Query(ctx context.Context, query string) (*QueryIterator, error) {
return c.QueryWithOptions(ctx, &DefaultQueryOptions, query)
return c.QueryWithOptions(ctx, &DefaultQueryOptions, query, nil)
}

// QueryWithOptions Query data from InfluxDB IOx with query options.
@@ -87,7 +87,7 @@ func (c *Client) Query(ctx context.Context, query string) (*QueryIterator, error
// Returns:
// - A custom iterator (*QueryIterator) that can also be used to get raw flightsql reader.
// - An error, if any.
func (c *Client) QueryWithOptions(ctx context.Context, options *QueryOptions, query string) (*QueryIterator, error) {
func (c *Client) QueryWithOptions(ctx context.Context, options *QueryOptions, query string, params map[string]interface{}) (*QueryIterator, error) {
if options == nil {
return nil, fmt.Errorf("options not set")
}
@@ -112,7 +112,9 @@ func (c *Client) QueryWithOptions(ctx context.Context, options *QueryOptions, qu
"sql_query": query,
"query_type": strings.ToLower(queryType.String()),
}

if params != nil {
ticketData["params"] = params;
}
ticketJSON, err := json.Marshal(ticketData)
if err != nil {
return nil, fmt.Errorf("serialize: %s", err)