This commit is contained in:
Michael McGuinness
2024-12-24 17:13:48 +00:00
parent 827d973053
commit 4dd050e390
46 changed files with 327 additions and 155 deletions
+17
View File
@@ -0,0 +1,17 @@
package jsonextractor
import (
"context"
)
type Result struct {
value string
}
func NewResult(value string) *Result {
return &Result{value}
}
func (r *Result) GetValue(ctx context.Context) (string, error) {
return r.value, nil
}
+8 -5
View File
@@ -4,10 +4,10 @@ import (
"context"
"encoding/json"
"fmt"
"gotemplate/internal/database"
"gotemplate/internal/database/repository"
"gotemplate/internal/query"
"gotemplate/internal/result"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
"queryorchestration/internal/result"
"github.com/tidwall/gjson"
)
@@ -29,7 +29,10 @@ func (e *Extractor) Process(ctx context.Context, query query.Query, values *[]re
return "", fmt.Errorf("JSON Extraction requires 1 result")
}
value := (*values)[0].Value
value, err := (*values)[0].GetValue(ctx)
if err != nil {
return "", err
}
byteConfig, err := e.db.GetQueryConfig(ctx, repository.GetQueryConfigParams{
Queryid: database.MustToDBUUID(query.ID),