Documentation
¶
Overview ¶
Package gqlcost provides cost analysis validation rule for github.com/graphql-go/graph
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCostAnalysisRule ¶
func AddCostAnalysisRule(opts AnalysisOptions)
AddCostAnalysisRule adds a rule of cost analysis to graphql.SpecifiedRules.
func AnalysisRule ¶
func AnalysisRule(opts AnalysisOptions) graphql.ValidationRuleFn
AnalysisRule provides cost analysis rule (function)
Types ¶
type AnalysisOptions ¶
type AnalysisOptions struct {
MaximumCost int
DefaultCost int
Valiables map[string]interface{}
CostMap CostMap
ComplexityRange ComplexityRange
}
AnalysisOptions provides options for cost analysis.
type ComplexityRange ¶
ComplexityRange provides valid complexity min and max values.
type Cost ¶
type Cost struct {
// UseMultipliers is flag to use multiplier.
// Multipliers and MultiplierFunc are referred only when this is true.
UseMultipliers bool `json:"useMultipliers,omitempty"`
// Complexity define default complexity of field or type.
Complexity int `json:"complexity,omitempty"`
// Multipliers enumerates name of arguments to be used to calculate
// multiplier.
Multipliers []string `json:"multipliers,omitempty"`
// MultiplierFunc is for customizing multiplier calculation.
// When it available Multipliers is ignored.
MultiplierFunc func(map[string]interface{}) int
}
Cost provides each cost value for type.field
type TypeCost ¶
type TypeCost struct {
// Cost is cost of type itself
Cost *Cost
// Fields is costs for each fields.
Fields FieldsCost
}
TypeCost provides costs for a type and its fields.
Click to show internal directories.
Click to hide internal directories.