Merged in feature/remove-query (pull request #201)
remove query from codebase part 1 * remove query * fix localstack run
This commit is contained in:
+2
-59
@@ -4,69 +4,12 @@ import (
|
||||
"errors"
|
||||
|
||||
"queryorchestration/internal/client"
|
||||
"queryorchestration/internal/query"
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func parseQueries(queries []*query.Query) ([]Query, error) {
|
||||
outQueries := make([]Query, len(queries))
|
||||
for index, query := range queries {
|
||||
qt, err := parseQuery(query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
outQueries[index] = *qt
|
||||
}
|
||||
|
||||
return outQueries, nil
|
||||
}
|
||||
|
||||
func parseQuery(query *query.Query) (*Query, error) {
|
||||
if query.RequiredQueryIDs != nil && len(*query.RequiredQueryIDs) == 0 {
|
||||
query.RequiredQueryIDs = nil
|
||||
}
|
||||
|
||||
qt, err := parseQueryType(query.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
q := &Query{
|
||||
Id: query.ID,
|
||||
Type: qt,
|
||||
ActiveVersion: query.ActiveVersion,
|
||||
LatestVersion: query.LatestVersion,
|
||||
RequiredQueries: query.RequiredQueryIDs,
|
||||
Config: query.Config,
|
||||
}
|
||||
|
||||
return q, nil
|
||||
}
|
||||
|
||||
func parseQueryType(qType resultprocessor.Type) (QueryType, error) {
|
||||
switch qType {
|
||||
case resultprocessor.TypeJsonExtractor:
|
||||
return JSONEXTRACTOR, nil
|
||||
case resultprocessor.TypeContextFull:
|
||||
return CONTEXTFULL, nil
|
||||
default:
|
||||
return "", errors.New("invalid query type")
|
||||
}
|
||||
}
|
||||
|
||||
func parseSpecQueryType(qType QueryType) (resultprocessor.Type, error) {
|
||||
switch qType {
|
||||
case JSONEXTRACTOR:
|
||||
return resultprocessor.TypeJsonExtractor, nil
|
||||
case CONTEXTFULL:
|
||||
return resultprocessor.TypeContextFull, nil
|
||||
default:
|
||||
return resultprocessor.Type(-1), errors.New("invalid query type")
|
||||
}
|
||||
}
|
||||
// Query parsing functions have been removed.
|
||||
// See remove_query_plan.md for details.
|
||||
|
||||
func parseStringToUUIDArray(sids *[]string) (*[]uuid.UUID, error) {
|
||||
var ids []uuid.UUID
|
||||
|
||||
Reference in New Issue
Block a user