Skip to content

Commit

Permalink
Adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski committed Jan 16, 2025
1 parent 230d76a commit ff4da05
Show file tree
Hide file tree
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
Expand Up @@ -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
Expand Up @@ -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)

Expand Down
23 changes: 22 additions & 1 deletion quesma/v2/core/quesma_apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand All @@ -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
}

Expand Down

0 comments on commit ff4da05

Please sign in to comment.