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

Provide SDK transform to get a qual value #77

Closed
e-gineer opened this issue Mar 26, 2021 · 0 comments
Closed

Provide SDK transform to get a qual value #77

e-gineer opened this issue Mar 26, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@e-gineer
Copy link
Contributor

It's common in some tables to need to return unchanged the qual that was passed in. For example, a query column in a search table.

I'd love SDK support to easily return the value of a qual as a column. e.g. return the query string column with the value of the query qual.

Consider this Slack search table as an example:

func tableSlackSearch() *plugin.Table {
	return &plugin.Table{
		Name:        "slack_search",
		Description: "Search slack for anything using a query.",
		List: &plugin.ListConfig{
			Hydrate:    listSearches,
			KeyColumns: plugin.SingleColumn("query"),
		},
		Columns: []*plugin.Column{
			// Top columns
			{Name: "query", Type: proto.ColumnType_STRING, Hydrate: queryString, Transform: transform.FromValue(), Description: "The search query."},
			...
		},
	}
}

func queryString(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData) (interface{}, error) {
	quals := d.KeyColumnQuals
	q := quals["query"].GetStringValue()
	return q, nil
}
@e-gineer e-gineer added the enhancement New feature or request label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant