-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6bc9e2
commit ad1d39b
Showing
6 changed files
with
101 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package backend | ||
|
||
import ( | ||
"context" | ||
) | ||
|
||
// QueryConversionHandler is an EXPERIMENTAL service that allows converting queries between versions | ||
|
||
type QueryConversionHandler interface { | ||
// ConvertQuery is called to covert queries between different versions | ||
ConvertQuery(context.Context, *QueryConversionRequest) (*QueryConversionResponse, error) | ||
} | ||
|
||
type ConvertQueryFunc func(context.Context, *QueryConversionRequest) (*QueryConversionResponse, error) | ||
|
||
// ConvertObjects calls fn(ctx, req). | ||
func (fn ConvertQueryFunc) ConvertQuery(ctx context.Context, req *QueryConversionRequest) (*QueryConversionResponse, error) { | ||
return fn(ctx, req) | ||
} | ||
|
||
// ConversionRequest supports converting an object from on version to another | ||
type QueryConversionRequest struct { | ||
// NOTE: this may not include app or datasource instance settings depending on the request | ||
PluginContext PluginContext `json:"pluginContext,omitempty"` | ||
// Queries to convert. This contains the full metadata envelope. | ||
Queries []DataQuery `json:"objects,omitempty"` | ||
} | ||
|
||
type QueryConversionResponse struct { | ||
// Converted queries. | ||
Queries []DataQuery `json:"objects,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters