package query import ( "context" "fmt" jsonextractor "gotemplate/internal/jsonExtractor" "gotemplate/internal/queryProcessor" "gotemplate/internal/result" ) func (q *Queue) prepareResult(ctx context.Context, query Query, resultValues *[]result.Value) (string, error) { processor, err := q.getProcessor(query.Type) if err != nil { return "", err } return processor.Process(ctx, query.ID, query.Version, resultValues) } func (q *Queue) getProcessor(queryType QueryType) (queryProcessor.Processor, error) { switch queryType { case QueryTypeJsonExtractor: return jsonextractor.New(q.db), nil default: return nil, fmt.Errorf("attempting to process invalid query type") } }