Skip to content

Commit

Permalink
Adding ComposeResult
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski committed Jan 16, 2025
1 parent bfa97ce commit 212cddc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quesma/processors/base_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (p *BaseProcessor) executeQuery(query string) ([]quesma_api.QueryResultRow,

func (p *BaseProcessor) Handle(metadata map[string]interface{}, messages ...any) (map[string]interface{}, any, error) {
logger.Debug().Msg("BaseProcessor: Handle")
var resp []byte
var resp any
for _, msg := range messages {
executionPlan, err := p.QueryTransformationPipeline.ParseQuery(msg)
if err != nil {
Expand All @@ -74,7 +74,7 @@ func (p *BaseProcessor) Handle(metadata map[string]interface{}, messages ...any)
}
// Transform the results
transformedResults := p.QueryTransformationPipeline.TransformResults(results)
resp = append(resp, []byte("qqq->")...)
resp = p.QueryTransformationPipeline.ComposeResult(transformedResults)
messages = append(messages, transformedResults)
}

Expand Down
7 changes: 7 additions & 0 deletions quesma/quesma/v2_test_objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,10 @@ func (p *QueryTransformationPipeline) TransformResults(results [][]quesma_api.Qu
logger.Debug().Msg("SimpleQueryTransformationPipeline: TransformResults")
return results
}

func (p *QueryTransformationPipeline) ComposeResult(results [][]quesma_api.QueryResultRow) any {
logger.Debug().Msg("SimpleQueryTransformationPipeline: ComposeResults")
var resp []byte
resp = append(resp, []byte("qqq->")...)
return resp
}
1 change: 1 addition & 0 deletions quesma/v2/core/quesma_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type QueryTransformationPipeline interface {
QueryTransformer
QueryResultTransformer
ParseQuery(message any) (*ExecutionPlan, error)
ComposeResult(results [][]QueryResultRow) any
AddTransformer(transformer QueryTransformer)
GetTransformers() []QueryTransformer
}
Expand Down

0 comments on commit 212cddc

Please sign in to comment.