Documentation ¶
Overview ¶
IMPORTANT: this is all copy paste, but with some changes to fix data mutation, leading to race conditions in runtime
Index ¶
- func ExtractValueModifyingSource(extractor PointDataExtractor, source map[string]interface{}, path []string) (map[string]interface{}, error)
- func FindInsertionPoints(targetPoints []string, selectionSet ast.SelectionSet, ...) ([][]string, error)
- func FindSelection(matchString string, selectionSet ast.SelectionSet) *ast.Field
- type CachedPointDataExtractor
- type DepthExecutor
- type DepthExecutorManager
- type DepthExecutorResponse
- type ExecutionContext
- type ExecutionRequest
- type ExecutionResult
- type Executor
- type ParallelExecutor
- type PointData
- type PointDataExtractor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractValueModifyingSource ¶
func ExtractValueModifyingSource( extractor PointDataExtractor, source map[string]interface{}, path []string, ) (map[string]interface{}, error)
ExtractValueModifyingSource gets object from source by path. If some fields in source are missing, it modifies source to fit the structure. for usage information check tests
func FindInsertionPoints ¶
func FindInsertionPoints( targetPoints []string, selectionSet ast.SelectionSet, result map[string]interface{}, startingPoints [][]string, ) ([][]string, error)
FindInsertionPoints returns the list of insertion points where provided step should be executed. for usage information check tests
func FindSelection ¶
func FindSelection(matchString string, selectionSet ast.SelectionSet) *ast.Field
Types ¶
type DepthExecutor ¶
type DepthExecutor struct { QueryPlanSteps []*planner.QueryPlanStep PointDataExtractor PointDataExtractor Depth int // contains filtered or unexported fields }
DepthExecutor uses provided QueryPlanSteps to execute against finite backend and provide requests for for DepthExecutor on next depth
func (*DepthExecutor) Execute ¶
func (de *DepthExecutor) Execute(ers []*ExecutionRequest) (*DepthExecutorResponse, error)
Execute takes execution requests and runs them async, gathering all errors and results
type DepthExecutorManager ¶
type DepthExecutorManager struct {
// contains filtered or unexported fields
}
func NewDepthExecutorManager ¶
func NewDepthExecutorManager(ctx *ExecutionContext) *DepthExecutorManager
func (*DepthExecutorManager) Execute ¶
func (dem *DepthExecutorManager) Execute() (map[string]interface{}, error)
Execute takes ExecutionContext and performs sequential execution for each depth in the plan.
type DepthExecutorResponse ¶
type DepthExecutorResponse struct { ExecutionResults []*ExecutionResult NextExecutionRequests []*ExecutionRequest }
DepthExecutorResponse represents single response of DepthExecutor.Execute, containing all accumulated data
type ExecutionContext ¶
type ExecutionRequest ¶
type ExecutionRequest struct { QueryPlanStep *planner.QueryPlanStep InsertionPoint []string }
ExecutionRequest contains all data needed for DepthExecutor to execute request
func (ExecutionRequest) ToGqlError ¶
func (er ExecutionRequest) ToGqlError(err error) *gqlerrors.Error
ToGqlError takes error and produces *gqlerrors.Error using er.InsertionPoint as path and err.Error as message. If err is already *gqlerrors.Error, it returns it as is.
type ExecutionResult ¶
ExecutionResult contains result of DepthExecutor executing single ExecutionRequest
type Executor ¶
type Executor interface {
Execute(*ExecutionContext) (map[string]interface{}, error)
}
type ParallelExecutor ¶
type ParallelExecutor func(*ExecutionContext) (map[string]interface{}, error)
ParallelExecutor executes the given query plan by starting at the root of the plan and walking down the path stitching the results together
func (ParallelExecutor) Execute ¶
func (executor ParallelExecutor) Execute(ctx *ExecutionContext) (map[string]interface{}, error)
Execute returns the result of the query plan for more information about usage, take a look at tests.