planner

package
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedPlanner

type CachedPlanner struct {
	TTL time.Duration

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCachedPlanner

func NewCachedPlanner(ttl time.Duration) *CachedPlanner

func (*CachedPlanner) Plan

func (cp *CachedPlanner) Plan(ctx *PlanningContext) (*QueryPlan, error)

func (*CachedPlanner) WithPlannerExecutor added in v0.1.8

func (cp *CachedPlanner) WithPlannerExecutor(e Planner) *CachedPlanner

type Planner

type Planner interface {
	Plan(*PlanningContext) (*QueryPlan, error)
}

type PlanningContext

type PlanningContext struct {
	Operation  *ast.OperationDefinition
	Request    *requests.Request
	Schema     *ast.Schema
	TypeURLMap merger.TypeURLMap
}

PlanningContext contains the necessary information used to plan a query.

func (*PlanningContext) GetURL

func (pc *PlanningContext) GetURL(typename, fieldname, fburl string) (string, error)

type QueryPlan

type QueryPlan struct {
	RootSteps   []*QueryPlanStep
	ScrubFields ScrubFields
}

QueryPlan is a query execution plan

func (*QueryPlan) SetComputedValues added in v0.1.6

func (qp *QueryPlan) SetComputedValues(ctx *PlanningContext) *QueryPlan

type QueryPlanStep

type QueryPlanStep struct {
	URL            string
	OperationName  *string
	ParentType     string
	SelectionSet   ast.SelectionSet
	InsertionPoint []string
	Then           []*QueryPlanStep

	// artifacts
	QueryString     string
	QueryStringHash [32]byte
	VariablesList   []string
	// contains filtered or unexported fields
}

Step is a single execution step

func (*QueryPlanStep) MarshalJSON

func (s *QueryPlanStep) MarshalJSON() ([]byte, error)

MarshalJSON marshals the step the JSON. Used for test purposes only

func (*QueryPlanStep) SetComputedValues added in v0.1.6

func (s *QueryPlanStep) SetComputedValues(ctx *PlanningContext) *QueryPlanStep

SetComputedValues sets VariablesList and Query for QueryPlanStep. It triggers SetComputedValues on child steps

type ScrubFields

type ScrubFields map[string]map[string][]string

func (ScrubFields) Clean

func (sf ScrubFields) Clean(payload map[string]interface{})

func (ScrubFields) Get

func (sf ScrubFields) Get(path []string, typename string) []string

func (ScrubFields) MarshalJSON

func (sf ScrubFields) MarshalJSON() ([]byte, error)

func (ScrubFields) Merge

func (sf ScrubFields) Merge(sfs ScrubFields)

func (ScrubFields) Set

func (sf ScrubFields) Set(path []string, typename, fieldname string)

type SequentialPlanner

type SequentialPlanner func(ctx *PlanningContext) (*QueryPlan, error)

func (SequentialPlanner) Plan

Plan returns a query plan from the given planning context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL