17 lines
423 B
Go
17 lines
423 B
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
jsonextractor "gotemplate/internal/jsonExtractor"
|
|
)
|
|
|
|
func (q *Queue) prepareResult(ctx context.Context, query Query, resultValues *[]ResultValue) (string, error) {
|
|
switch query.Type {
|
|
case QueryTypeJsonExtractor:
|
|
return jsonextractor.Process(query.ID, query.Version, (*resultValues)[0].Value)
|
|
default:
|
|
return "", fmt.Errorf("attempting to process invalid query type")
|
|
}
|
|
}
|