creatorupdatordeprecate
This commit is contained in:
@@ -7,10 +7,9 @@ import (
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
jsonextractor "queryorchestration/internal/jsonExtractor"
|
||||
"queryorchestration/internal/query"
|
||||
queryprocessor "queryorchestration/internal/queryProcessor"
|
||||
"queryorchestration/internal/result"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
@@ -31,16 +30,9 @@ func (q *Queue) Execute(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (q *Queue) executeQuery(ctx context.Context, qu query.QueryRow) error {
|
||||
requiredQueryIDs := []uuid.UUID{}
|
||||
for _, entry := range *q.collectorQueries {
|
||||
if entry.ID == qu.ID && entry.RequiredQueryID != uuid.Nil {
|
||||
requiredQueryIDs = append(requiredQueryIDs, entry.RequiredQueryID)
|
||||
}
|
||||
}
|
||||
|
||||
resultIDs := make([]pgtype.UUID, len(requiredQueryIDs))
|
||||
for index, id := range requiredQueryIDs {
|
||||
func (q *Queue) executeQuery(ctx context.Context, qu queryprocessor.Query) error {
|
||||
resultIDs := make([]pgtype.UUID, len(qu.RequiredQueryIDs))
|
||||
for index, id := range qu.RequiredQueryIDs {
|
||||
var queryVersion int32
|
||||
for _, entry := range *q.collectorQueries {
|
||||
if entry.ID == id {
|
||||
@@ -81,7 +73,7 @@ func (q *Queue) executeQuery(ctx context.Context, qu query.QueryRow) error {
|
||||
}
|
||||
|
||||
func (q *Queue) getResultValue(res *repository.ListResultValuesByIDRow) (result.Value, error) {
|
||||
var queryType query.Type
|
||||
var queryType queryprocessor.Type
|
||||
for _, qu := range *q.collectorQueries {
|
||||
if qu.ID == database.MustToUUID(res.Queryid) {
|
||||
queryType = qu.Type
|
||||
@@ -89,9 +81,9 @@ func (q *Queue) getResultValue(res *repository.ListResultValuesByIDRow) (result.
|
||||
}
|
||||
|
||||
switch queryType {
|
||||
case query.TypeJsonExtractor:
|
||||
case queryprocessor.TypeJsonExtractor:
|
||||
return jsonextractor.NewResult(res.Value), nil
|
||||
case query.TypeContextFull:
|
||||
case queryprocessor.TypeContextFull:
|
||||
return contextfull.NewResult(res.Value), nil
|
||||
default:
|
||||
return nil, fmt.Errorf("attempting to process invalid query type")
|
||||
|
||||
Reference in New Issue
Block a user