Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding comments
Browse files Browse the repository at this point in the history
pdelewski committed Jan 16, 2025
1 parent e02f5d1 commit 9d72288
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion quesma/processors/base_processor.go
Original file line number Diff line number Diff line change
@@ -80,6 +80,6 @@ func (p *BaseProcessor) Handle(metadata map[string]interface{}, messages ...any)
return metadata, resp, nil
}

func (p *BaseProcessor) RegisterTransfomationPipeline(pipeline quesma_api.QueryTransformationPipeline) {
func (p *BaseProcessor) RegisterTransformationPipeline(pipeline quesma_api.QueryTransformationPipeline) {
p.QueryTransformationPipeline = pipeline
}
2 changes: 1 addition & 1 deletion quesma/quesma/v2_test.go
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ func full_workflow_scenario() quesma_api.QuesmaBuilder {

queryTransformationPipe := NewQueryTransformationPipeline()
queryTransformationPipe.AddTransformer(NewQueryTransformer1())
queryProcessor.RegisterTransfomationPipeline(queryTransformationPipe)
queryProcessor.RegisterTransformationPipeline(queryTransformationPipe)
queryPipeline.AddProcessor(queryProcessor)
quesmaBuilder.AddPipeline(queryPipeline)

23 changes: 22 additions & 1 deletion quesma/v2/core/quesma_apis.go
Original file line number Diff line number Diff line change
@@ -75,22 +75,37 @@ type QuesmaBuilder interface {
Stop(ctx context.Context)
}

// Query This is placeholder
// Concrete definition will be taken
// from `quesma/model/query.go`
type Query struct {
Query string
}

// ExecutionPlan This is placeholder
// Concrete definition will be taken
// from `quesma/model/query.go`
type ExecutionPlan struct {
Queries []*Query
}

// QueryResultTransformer This is a copy of the
// interface `ResultTransformer` from `quesma/model/transformers.go`
// from `quesma/model/transformers.go`
type QueryResultTransformer interface {
TransformResults(results [][]QueryResultRow) [][]QueryResultRow
}

// QueryTransformer This is a copy of the
// interface `QueryTransformer` from `quesma/model/transformers.go`
// from `quesma/model/transformers.go`
type QueryTransformer interface {
Transform(query []*Query) ([]*Query, error)
}

// QueryTransformationPipeline is the interface that parsing and composing
// `QueryTransformer` and `QueryResultTransformer`
// and makes body of BaseProcessor::Handle() method
type QueryTransformationPipeline interface {
QueryTransformer
QueryResultTransformer
@@ -100,9 +115,13 @@ type QueryTransformationPipeline interface {
GetTransformers() []QueryTransformer
}

// QueryResultRow This is a copy of the
// struct `QueryResultRow` from `quesma/model/query.go`
// and something that we should unify
type QueryResultRow struct {
}

// QueryExecutor is the interface that wraps the ExecuteQuery method.
type QueryExecutor interface {
ExecuteQuery(query string) ([]QueryResultRow, error)
}
@@ -115,7 +134,9 @@ type Processor interface {
SetBackendConnectors(conns map[BackendConnectorType]BackendConnector)
GetBackendConnector(connectorType BackendConnectorType) BackendConnector
GetSupportedBackendConnectors() []BackendConnectorType
RegisterTransfomationPipeline(pipeline QueryTransformationPipeline)
// RegisterTransformationPipeline method can be part of BaseProcessor
// not interface itself
RegisterTransformationPipeline(pipeline QueryTransformationPipeline)
Init() error
}

0 comments on commit 9d72288

Please sign in to comment.