Documentation ¶
Overview ¶
Package gqt provides a GraphQL Query Template language (GQT) parser. The parser can be used in both schemaless and schema-aware modes. To use the schema-aware mode create a parser instance using NewParser and provide all .graphqls schema files. gqt.Parse will parse the template in schemaless mode.
Index ¶
- func Parse(src []byte) (operation *Operation, variables map[string]*VariableDeclaration, ...)
- func WriteYAML(w io.Writer, o *Operation) error
- type Argument
- type ArgumentList
- type Array
- type ConstrAny
- type ConstrEquals
- type ConstrGreater
- type ConstrGreaterOrEqual
- type ConstrLenEquals
- type ConstrLenGreater
- type ConstrLenGreaterOrEqual
- type ConstrLenLess
- type ConstrLenLessOrEqual
- type ConstrLenNotEquals
- type ConstrLess
- type ConstrLessOrEqual
- type ConstrMap
- type ConstrNotEquals
- type Enum
- type Error
- type ExprAddition
- type ExprDivision
- type ExprEqual
- type ExprGreater
- type ExprGreaterOrEqual
- type ExprLess
- type ExprLessOrEqual
- type ExprLogicalAnd
- type ExprLogicalNegation
- type ExprLogicalOr
- type ExprModulo
- type ExprMultiplication
- type ExprNotEqual
- type ExprNumericNegation
- type ExprParentheses
- type ExprSubtraction
- type Expression
- type False
- type LocRange
- type Location
- type LocationEnd
- type Name
- type Null
- type Number
- type Object
- type ObjectField
- type Operation
- type OperationType
- type Parser
- type Selection
- type SelectionField
- type SelectionInlineFrag
- type SelectionMax
- type SelectionSet
- type Source
- type String
- type True
- type TypeCondition
- type Variable
- type VariableDeclaration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Argument ¶
type Argument struct { LocRange Name Parent Expression AssociatedVariable *VariableDeclaration Constraint Expression Def *ast.ArgumentDefinition }
Argument is an input argument.
func (*Argument) GetLocation ¶
func (*Argument) GetParent ¶
func (e *Argument) GetParent() Expression
func (*Argument) MarshalYAML ¶
func (*Argument) TypeDesignation ¶
type ArgumentList ¶
ArgumentList is an argument list.
func (ArgumentList) MarshalYAML ¶
func (l ArgumentList) MarshalYAML() (any, error)
type Array ¶
type Array struct { LocRange Parent Expression Items []Expression Type *ast.Type }
Array is an array value constant or an array constraint.
func (*Array) GetLocation ¶
func (*Array) GetParent ¶
func (e *Array) GetParent() Expression
func (*Array) MarshalYAML ¶
func (*Array) TypeDesignation ¶
type ConstrAny ¶
type ConstrAny struct { LocRange Parent Expression }
ConstrAny is the any value constraint (*)
func (*ConstrAny) GetLocation ¶
func (*ConstrAny) GetParent ¶
func (e *ConstrAny) GetParent() Expression
func (*ConstrAny) MarshalYAML ¶
func (*ConstrAny) TypeDesignation ¶
type ConstrEquals ¶
type ConstrEquals struct { LocRange Parent Expression Value Expression }
ConstrEquals is the equality constraint
func (*ConstrEquals) GetLocation ¶
func (e *ConstrEquals) GetLocation() LocRange
func (*ConstrEquals) GetParent ¶
func (e *ConstrEquals) GetParent() Expression
func (*ConstrEquals) IsFloat ¶
func (e *ConstrEquals) IsFloat() bool
func (*ConstrEquals) MarshalYAML ¶
func (c *ConstrEquals) MarshalYAML() (any, error)
func (*ConstrEquals) TypeDesignation ¶
func (e *ConstrEquals) TypeDesignation() string
type ConstrGreater ¶
type ConstrGreater struct { LocRange Parent Expression Value Expression }
ConstrGreater is the relational "greater than" constraint (>)
func (*ConstrGreater) GetLocation ¶
func (e *ConstrGreater) GetLocation() LocRange
func (*ConstrGreater) GetParent ¶
func (e *ConstrGreater) GetParent() Expression
func (*ConstrGreater) IsFloat ¶
func (e *ConstrGreater) IsFloat() bool
func (*ConstrGreater) MarshalYAML ¶
func (c *ConstrGreater) MarshalYAML() (any, error)
func (*ConstrGreater) TypeDesignation ¶
func (e *ConstrGreater) TypeDesignation() string
type ConstrGreaterOrEqual ¶
type ConstrGreaterOrEqual struct { LocRange Parent Expression Value Expression }
ConstrGreater is the relational "greater than or equal" constraint (>=)
func (*ConstrGreaterOrEqual) GetLocation ¶
func (e *ConstrGreaterOrEqual) GetLocation() LocRange
func (*ConstrGreaterOrEqual) GetParent ¶
func (e *ConstrGreaterOrEqual) GetParent() Expression
func (*ConstrGreaterOrEqual) IsFloat ¶
func (e *ConstrGreaterOrEqual) IsFloat() bool
func (*ConstrGreaterOrEqual) MarshalYAML ¶
func (c *ConstrGreaterOrEqual) MarshalYAML() (any, error)
func (*ConstrGreaterOrEqual) TypeDesignation ¶
func (e *ConstrGreaterOrEqual) TypeDesignation() string
type ConstrLenEquals ¶
type ConstrLenEquals struct { LocRange Parent Expression Value Expression }
ConstrLenEquals is the relational length equality constraint for String or array values.
func (*ConstrLenEquals) GetLocation ¶
func (e *ConstrLenEquals) GetLocation() LocRange
func (*ConstrLenEquals) GetParent ¶
func (e *ConstrLenEquals) GetParent() Expression
func (*ConstrLenEquals) IsFloat ¶
func (e *ConstrLenEquals) IsFloat() bool
func (*ConstrLenEquals) MarshalYAML ¶
func (c *ConstrLenEquals) MarshalYAML() (any, error)
func (*ConstrLenEquals) TypeDesignation ¶
func (e *ConstrLenEquals) TypeDesignation() string
type ConstrLenGreater ¶
type ConstrLenGreater struct { LocRange Parent Expression Value Expression }
ConstrLenGreater is the relational "greater than" constraint for String or array values (len >).
func (*ConstrLenGreater) GetLocation ¶
func (e *ConstrLenGreater) GetLocation() LocRange
func (*ConstrLenGreater) GetParent ¶
func (e *ConstrLenGreater) GetParent() Expression
func (*ConstrLenGreater) IsFloat ¶
func (e *ConstrLenGreater) IsFloat() bool
func (*ConstrLenGreater) MarshalYAML ¶
func (c *ConstrLenGreater) MarshalYAML() (any, error)
func (*ConstrLenGreater) TypeDesignation ¶
func (e *ConstrLenGreater) TypeDesignation() string
type ConstrLenGreaterOrEqual ¶
type ConstrLenGreaterOrEqual struct { LocRange Parent Expression Value Expression }
ConstrLenGreaterOrEqual is the relational "greater than or equal" constraint for String or array values (len >=).
func (*ConstrLenGreaterOrEqual) GetLocation ¶
func (e *ConstrLenGreaterOrEqual) GetLocation() LocRange
func (*ConstrLenGreaterOrEqual) GetParent ¶
func (e *ConstrLenGreaterOrEqual) GetParent() Expression
func (*ConstrLenGreaterOrEqual) IsFloat ¶
func (e *ConstrLenGreaterOrEqual) IsFloat() bool
func (*ConstrLenGreaterOrEqual) MarshalYAML ¶
func (c *ConstrLenGreaterOrEqual) MarshalYAML() (any, error)
func (*ConstrLenGreaterOrEqual) TypeDesignation ¶
func (e *ConstrLenGreaterOrEqual) TypeDesignation() string
type ConstrLenLess ¶
type ConstrLenLess struct { LocRange Parent Expression Value Expression }
ConstrLenLess is the relational "length less than" constraint for String or array values (len <).
func (*ConstrLenLess) GetLocation ¶
func (e *ConstrLenLess) GetLocation() LocRange
func (*ConstrLenLess) GetParent ¶
func (e *ConstrLenLess) GetParent() Expression
func (*ConstrLenLess) IsFloat ¶
func (e *ConstrLenLess) IsFloat() bool
func (*ConstrLenLess) MarshalYAML ¶
func (c *ConstrLenLess) MarshalYAML() (any, error)
func (*ConstrLenLess) TypeDesignation ¶
func (e *ConstrLenLess) TypeDesignation() string
type ConstrLenLessOrEqual ¶
type ConstrLenLessOrEqual struct { LocRange Parent Expression Value Expression }
ConstrLenLessOrEqual is the relational "length less than or equal" constraint for String or array values (len <=).
func (*ConstrLenLessOrEqual) GetLocation ¶
func (e *ConstrLenLessOrEqual) GetLocation() LocRange
func (*ConstrLenLessOrEqual) GetParent ¶
func (e *ConstrLenLessOrEqual) GetParent() Expression
func (*ConstrLenLessOrEqual) IsFloat ¶
func (e *ConstrLenLessOrEqual) IsFloat() bool
func (*ConstrLenLessOrEqual) MarshalYAML ¶
func (c *ConstrLenLessOrEqual) MarshalYAML() (any, error)
func (*ConstrLenLessOrEqual) TypeDesignation ¶
func (e *ConstrLenLessOrEqual) TypeDesignation() string
type ConstrLenNotEquals ¶
type ConstrLenNotEquals struct { LocRange Parent Expression Value Expression }
ConstrLenNotEquals is the relational length inequality constraint for String or array values.
func (*ConstrLenNotEquals) GetLocation ¶
func (e *ConstrLenNotEquals) GetLocation() LocRange
func (*ConstrLenNotEquals) GetParent ¶
func (e *ConstrLenNotEquals) GetParent() Expression
func (*ConstrLenNotEquals) IsFloat ¶
func (e *ConstrLenNotEquals) IsFloat() bool
func (*ConstrLenNotEquals) MarshalYAML ¶
func (c *ConstrLenNotEquals) MarshalYAML() (any, error)
func (*ConstrLenNotEquals) TypeDesignation ¶
func (e *ConstrLenNotEquals) TypeDesignation() string
type ConstrLess ¶
type ConstrLess struct { LocRange Parent Expression Value Expression }
ConstrLess is the relational "less than" constraint (<)
func (*ConstrLess) GetLocation ¶
func (e *ConstrLess) GetLocation() LocRange
func (*ConstrLess) GetParent ¶
func (e *ConstrLess) GetParent() Expression
func (*ConstrLess) IsFloat ¶
func (e *ConstrLess) IsFloat() bool
func (*ConstrLess) MarshalYAML ¶
func (c *ConstrLess) MarshalYAML() (any, error)
func (*ConstrLess) TypeDesignation ¶
func (e *ConstrLess) TypeDesignation() string
type ConstrLessOrEqual ¶
type ConstrLessOrEqual struct { LocRange Parent Expression Value Expression }
ConstrLess is the relational "less than or equal" constraint (<=)
func (*ConstrLessOrEqual) GetLocation ¶
func (e *ConstrLessOrEqual) GetLocation() LocRange
func (*ConstrLessOrEqual) GetParent ¶
func (e *ConstrLessOrEqual) GetParent() Expression
func (*ConstrLessOrEqual) IsFloat ¶
func (e *ConstrLessOrEqual) IsFloat() bool
func (*ConstrLessOrEqual) MarshalYAML ¶
func (c *ConstrLessOrEqual) MarshalYAML() (any, error)
func (*ConstrLessOrEqual) TypeDesignation ¶
func (e *ConstrLessOrEqual) TypeDesignation() string
type ConstrMap ¶
type ConstrMap struct { LocRange Parent Expression Constraint Expression }
ConstrMap maps a constraint to all items of the array.
func (*ConstrMap) GetLocation ¶
func (*ConstrMap) GetParent ¶
func (e *ConstrMap) GetParent() Expression
func (*ConstrMap) MarshalYAML ¶
func (*ConstrMap) TypeDesignation ¶
type ConstrNotEquals ¶
type ConstrNotEquals struct { LocRange Parent Expression Value Expression }
ConstrNotEquals is the inequality constraint
func (*ConstrNotEquals) GetLocation ¶
func (e *ConstrNotEquals) GetLocation() LocRange
func (*ConstrNotEquals) GetParent ¶
func (e *ConstrNotEquals) GetParent() Expression
func (*ConstrNotEquals) IsFloat ¶
func (e *ConstrNotEquals) IsFloat() bool
func (*ConstrNotEquals) MarshalYAML ¶
func (c *ConstrNotEquals) MarshalYAML() (any, error)
func (*ConstrNotEquals) TypeDesignation ¶
func (e *ConstrNotEquals) TypeDesignation() string
type Enum ¶
type Enum struct { LocRange Parent Expression Value string TypeDef *ast.Definition }
Enum is an enumeration value constant.
func (*Enum) GetLocation ¶
func (*Enum) GetParent ¶
func (e *Enum) GetParent() Expression
func (*Enum) MarshalYAML ¶
func (*Enum) TypeDesignation ¶
type ExprAddition ¶
type ExprAddition struct { LocRange Parent Expression AddendLeft Expression AddendRight Expression Float bool }
ExprAddition is an arithmetic addition expression using the operator "+".
func (*ExprAddition) GetLocation ¶
func (e *ExprAddition) GetLocation() LocRange
func (*ExprAddition) GetParent ¶
func (e *ExprAddition) GetParent() Expression
func (*ExprAddition) IsFloat ¶
func (e *ExprAddition) IsFloat() bool
func (*ExprAddition) MarshalYAML ¶
func (e *ExprAddition) MarshalYAML() (any, error)
func (*ExprAddition) TypeDesignation ¶
func (e *ExprAddition) TypeDesignation() string
type ExprDivision ¶
type ExprDivision struct { LocRange Parent Expression Dividend Expression Divisor Expression Float bool }
ExprDivision is an arithmetic division expression using the operator "/".
func (*ExprDivision) GetLocation ¶
func (e *ExprDivision) GetLocation() LocRange
func (*ExprDivision) GetParent ¶
func (e *ExprDivision) GetParent() Expression
func (*ExprDivision) IsFloat ¶
func (e *ExprDivision) IsFloat() bool
func (*ExprDivision) MarshalYAML ¶
func (e *ExprDivision) MarshalYAML() (any, error)
func (*ExprDivision) TypeDesignation ¶
func (e *ExprDivision) TypeDesignation() string
type ExprEqual ¶
type ExprEqual struct { LocRange Parent Expression Left Expression Right Expression }
ExprEqual is a boolean equality expression using the operator "==".
func (*ExprEqual) GetLocation ¶
func (*ExprEqual) GetParent ¶
func (e *ExprEqual) GetParent() Expression
func (*ExprEqual) MarshalYAML ¶
func (*ExprEqual) TypeDesignation ¶
type ExprGreater ¶
type ExprGreater struct { LocRange Parent Expression Left Expression Right Expression }
ExprGreater is a boolean relational "greater than" expression using the operator ">".
func (*ExprGreater) GetLocation ¶
func (e *ExprGreater) GetLocation() LocRange
func (*ExprGreater) GetParent ¶
func (e *ExprGreater) GetParent() Expression
func (*ExprGreater) IsFloat ¶
func (e *ExprGreater) IsFloat() bool
func (*ExprGreater) MarshalYAML ¶
func (e *ExprGreater) MarshalYAML() (any, error)
func (*ExprGreater) TypeDesignation ¶
func (e *ExprGreater) TypeDesignation() string
type ExprGreaterOrEqual ¶
type ExprGreaterOrEqual struct { LocRange Parent Expression Left Expression Right Expression }
ExprGreaterOrEqual is a boolean relational "greater than or equal" expression using the operator ">=".
func (*ExprGreaterOrEqual) GetLocation ¶
func (e *ExprGreaterOrEqual) GetLocation() LocRange
func (*ExprGreaterOrEqual) GetParent ¶
func (e *ExprGreaterOrEqual) GetParent() Expression
func (*ExprGreaterOrEqual) IsFloat ¶
func (e *ExprGreaterOrEqual) IsFloat() bool
func (*ExprGreaterOrEqual) MarshalYAML ¶
func (e *ExprGreaterOrEqual) MarshalYAML() (any, error)
func (*ExprGreaterOrEqual) TypeDesignation ¶
func (e *ExprGreaterOrEqual) TypeDesignation() string
type ExprLess ¶
type ExprLess struct { LocRange Parent Expression Left Expression Right Expression }
ExprLess is a boolean relational "less than" expression using the operator "<".
func (*ExprLess) GetLocation ¶
func (*ExprLess) GetParent ¶
func (e *ExprLess) GetParent() Expression
func (*ExprLess) MarshalYAML ¶
func (*ExprLess) TypeDesignation ¶
type ExprLessOrEqual ¶
type ExprLessOrEqual struct { LocRange Parent Expression Left Expression Right Expression }
ExprLessOrEqual is a boolean relational "less than or equal" expression using the operator "<=".
func (*ExprLessOrEqual) GetLocation ¶
func (e *ExprLessOrEqual) GetLocation() LocRange
func (*ExprLessOrEqual) GetParent ¶
func (e *ExprLessOrEqual) GetParent() Expression
func (*ExprLessOrEqual) IsFloat ¶
func (e *ExprLessOrEqual) IsFloat() bool
func (*ExprLessOrEqual) MarshalYAML ¶
func (e *ExprLessOrEqual) MarshalYAML() (any, error)
func (*ExprLessOrEqual) TypeDesignation ¶
func (e *ExprLessOrEqual) TypeDesignation() string
type ExprLogicalAnd ¶
type ExprLogicalAnd struct { LocRange Parent Expression Expressions []Expression }
ExprLogicalAnd is a boolean logical AND expression using the operator "&&".
func (*ExprLogicalAnd) GetLocation ¶
func (e *ExprLogicalAnd) GetLocation() LocRange
func (*ExprLogicalAnd) GetParent ¶
func (e *ExprLogicalAnd) GetParent() Expression
func (*ExprLogicalAnd) IsFloat ¶
func (e *ExprLogicalAnd) IsFloat() bool
func (*ExprLogicalAnd) MarshalYAML ¶
func (e *ExprLogicalAnd) MarshalYAML() (any, error)
func (*ExprLogicalAnd) TypeDesignation ¶
func (e *ExprLogicalAnd) TypeDesignation() string
type ExprLogicalNegation ¶
type ExprLogicalNegation struct { LocRange Parent Expression Expression Expression }
ExprLogicalNegation is a logical negation expression using the prefix operator "!".
func (*ExprLogicalNegation) GetLocation ¶
func (e *ExprLogicalNegation) GetLocation() LocRange
func (*ExprLogicalNegation) GetParent ¶
func (e *ExprLogicalNegation) GetParent() Expression
func (*ExprLogicalNegation) IsFloat ¶
func (e *ExprLogicalNegation) IsFloat() bool
func (*ExprLogicalNegation) MarshalYAML ¶
func (e *ExprLogicalNegation) MarshalYAML() (any, error)
func (*ExprLogicalNegation) TypeDesignation ¶
func (e *ExprLogicalNegation) TypeDesignation() string
type ExprLogicalOr ¶
type ExprLogicalOr struct { LocRange Parent Expression Expressions []Expression }
ExprLogicalOr is a boolean logical OR expression using the operator "||".
func (*ExprLogicalOr) GetLocation ¶
func (e *ExprLogicalOr) GetLocation() LocRange
func (*ExprLogicalOr) GetParent ¶
func (e *ExprLogicalOr) GetParent() Expression
func (*ExprLogicalOr) IsFloat ¶
func (e *ExprLogicalOr) IsFloat() bool
func (*ExprLogicalOr) MarshalYAML ¶
func (e *ExprLogicalOr) MarshalYAML() (any, error)
func (*ExprLogicalOr) TypeDesignation ¶
func (e *ExprLogicalOr) TypeDesignation() string
type ExprModulo ¶
type ExprModulo struct { LocRange Parent Expression Dividend Expression Divisor Expression Float bool }
ExprModulo is a modulo expression using the operator "%".
func (*ExprModulo) GetLocation ¶
func (e *ExprModulo) GetLocation() LocRange
func (*ExprModulo) GetParent ¶
func (e *ExprModulo) GetParent() Expression
func (*ExprModulo) IsFloat ¶
func (e *ExprModulo) IsFloat() bool
func (*ExprModulo) MarshalYAML ¶
func (e *ExprModulo) MarshalYAML() (any, error)
func (*ExprModulo) TypeDesignation ¶
func (e *ExprModulo) TypeDesignation() string
type ExprMultiplication ¶
type ExprMultiplication struct { LocRange Parent Expression Multiplicant Expression Multiplicator Expression Float bool }
ExprMultiplication is an arithmetic multiplication expression using the operator "*".
func (*ExprMultiplication) GetLocation ¶
func (e *ExprMultiplication) GetLocation() LocRange
func (*ExprMultiplication) GetParent ¶
func (e *ExprMultiplication) GetParent() Expression
func (*ExprMultiplication) IsFloat ¶
func (e *ExprMultiplication) IsFloat() bool
func (*ExprMultiplication) MarshalYAML ¶
func (e *ExprMultiplication) MarshalYAML() (any, error)
func (*ExprMultiplication) TypeDesignation ¶
func (e *ExprMultiplication) TypeDesignation() string
type ExprNotEqual ¶
type ExprNotEqual struct { LocRange Parent Expression Left Expression Right Expression }
ExprNotEqual is a boolean inequality expression using the operator "!=".
func (*ExprNotEqual) GetLocation ¶
func (e *ExprNotEqual) GetLocation() LocRange
func (*ExprNotEqual) GetParent ¶
func (e *ExprNotEqual) GetParent() Expression
func (*ExprNotEqual) IsFloat ¶
func (e *ExprNotEqual) IsFloat() bool
func (*ExprNotEqual) MarshalYAML ¶
func (e *ExprNotEqual) MarshalYAML() (any, error)
func (*ExprNotEqual) TypeDesignation ¶
func (e *ExprNotEqual) TypeDesignation() string
type ExprNumericNegation ¶
type ExprNumericNegation struct { LocRange Parent Expression Expression Expression Float bool }
ExprNumericNegation is a numeric negation expression using the prefix operator "-".
func (*ExprNumericNegation) GetLocation ¶
func (e *ExprNumericNegation) GetLocation() LocRange
func (*ExprNumericNegation) GetParent ¶
func (e *ExprNumericNegation) GetParent() Expression
func (*ExprNumericNegation) IsFloat ¶
func (e *ExprNumericNegation) IsFloat() bool
func (*ExprNumericNegation) MarshalYAML ¶
func (e *ExprNumericNegation) MarshalYAML() (any, error)
func (*ExprNumericNegation) TypeDesignation ¶
func (e *ExprNumericNegation) TypeDesignation() string
type ExprParentheses ¶
type ExprParentheses struct { LocRange Parent Expression Expression Expression }
ExprParentheses is an expression enclosed by parentheses.
func (*ExprParentheses) GetLocation ¶
func (e *ExprParentheses) GetLocation() LocRange
func (*ExprParentheses) GetParent ¶
func (e *ExprParentheses) GetParent() Expression
func (*ExprParentheses) IsFloat ¶
func (e *ExprParentheses) IsFloat() bool
func (*ExprParentheses) MarshalYAML ¶
func (e *ExprParentheses) MarshalYAML() (any, error)
func (*ExprParentheses) TypeDesignation ¶
func (e *ExprParentheses) TypeDesignation() string
type ExprSubtraction ¶
type ExprSubtraction struct { LocRange Parent Expression Minuend Expression Subtrahend Expression Float bool }
ExprSubtraction is an arithmetic subtraction expression using the operator "-".
func (*ExprSubtraction) GetLocation ¶
func (e *ExprSubtraction) GetLocation() LocRange
func (*ExprSubtraction) GetParent ¶
func (e *ExprSubtraction) GetParent() Expression
func (*ExprSubtraction) IsFloat ¶
func (e *ExprSubtraction) IsFloat() bool
func (*ExprSubtraction) MarshalYAML ¶
func (e *ExprSubtraction) MarshalYAML() (any, error)
func (*ExprSubtraction) TypeDesignation ¶
func (e *ExprSubtraction) TypeDesignation() string
type Expression ¶
type Expression interface { GetParent() Expression GetLocation() LocRange TypeDesignation() string IsFloat() bool }
Expression can be either of:
- *Operation
- *ConstrAny
- *ConstrEquals
- *ConstrNotEquals
- *ConstrLess
- *ConstrLessOrEqual
- *ConstrGreater
- *ConstrGreaterOrEqual
- *ConstrLenEquals
- *ConstrLenNotEquals
- *ConstrLenLess
- *ConstrLenLessOrEqual
- *ConstrLenGreater
- *ConstrLenGreaterOrEqual
- *ConstrMap
- *ExprParentheses
- *ExprModulo
- *ExprDivision
- *ExprMultiplication
- *ExprAddition
- *ExprSubtraction
- *ExprLogicalNegation
- *ExprNumericNegation
- *ExprEqual
- *ExprNotEqual
- *ExprLess
- *ExprLessOrEqual
- *ExprGreater
- *ExprGreaterOrEqual
- *ExprLogicalAnd
- *ExprLogicalOr
- *True
- *False
- *Int
- *Float
- *String
- *Null
- *Enum
- *Array
- *Object
- *Variable
- *SelectionInlineFrag
- *ObjectField
- *SelectionField
- *SelectionMax
- *Argument
func Optimize ¶
func Optimize(e Expression) Expression
Optimize recursively reduces all constant expressions inside e. For example, an addition expression where the left and right addends are constant or reducable expressions will be reduced to, or in other words, replaced with a single constant containing the resulting sum.
type False ¶
type False struct { LocRange Parent Expression TypeDef *ast.Definition }
False is a boolean value constant.
func (*False) GetLocation ¶
func (*False) GetParent ¶
func (e *False) GetParent() Expression
func (*False) MarshalYAML ¶
func (*False) TypeDesignation ¶
type LocRange ¶
type LocRange struct { Location LocationEnd }
LocRange defines the start and end locations of an expression.
func (LocRange) MarshalYAML ¶
type Location ¶
type Location struct{ Index, Line, Column int }
Location defines the start location of an expression.
type LocationEnd ¶
type LocationEnd struct{ IndexEnd, LineEnd, ColumnEnd int }
LocationEnd defines the end location of an expression.
type Name ¶
func (Name) MarshalYAML ¶
type Null ¶
type Null struct { LocRange Parent Expression Type *ast.Type }
Null is a null-value constant.
func (*Null) GetLocation ¶
func (*Null) GetParent ¶
func (e *Null) GetParent() Expression
func (*Null) MarshalYAML ¶
func (*Null) TypeDesignation ¶
type Number ¶
type Number struct { LocRange Parent Expression Value string TypeDef *ast.Definition // contains filtered or unexported fields }
func (*Number) Float ¶
Float returns the float64 value and true if the number is of type Float, otherwise returns 0 and false.
func (*Number) GetLocation ¶
func (*Number) GetParent ¶
func (e *Number) GetParent() Expression
func (*Number) Int ¶
Int returns the integer value and true if the number is of type Int, otherwise returns 0 and false.
func (*Number) MarshalYAML ¶
func (*Number) TypeDesignation ¶
type Object ¶
type Object struct { LocRange Parent Expression Fields []*ObjectField TypeDef *ast.Definition }
Object is an input object constraint.
func (*Object) GetLocation ¶
func (*Object) GetParent ¶
func (e *Object) GetParent() Expression
func (*Object) MarshalYAML ¶
func (*Object) TypeDesignation ¶
type ObjectField ¶
type ObjectField struct { LocRange Name Parent Expression AssociatedVariable *VariableDeclaration Constraint Expression Def *ast.FieldDefinition }
ObjectField is an input object field.
func (*ObjectField) GetLocation ¶
func (e *ObjectField) GetLocation() LocRange
func (*ObjectField) GetParent ¶
func (e *ObjectField) GetParent() Expression
func (*ObjectField) IsFloat ¶
func (e *ObjectField) IsFloat() bool
func (*ObjectField) MarshalYAML ¶
func (f *ObjectField) MarshalYAML() (any, error)
func (*ObjectField) TypeDesignation ¶
func (e *ObjectField) TypeDesignation() string
type Operation ¶
type Operation struct { LocRange Type OperationType SelectionSet Def *ast.Definition }
Operation is the root of the abstract syntax tree of an operation.
func (*Operation) GetLocation ¶
func (*Operation) GetParent ¶
func (e *Operation) GetParent() Expression
func (*Operation) MarshalYAML ¶
func (*Operation) TypeDesignation ¶
type OperationType ¶
type OperationType int8
const ( OperationTypeQuery OperationType OperationTypeMutation OperationTypeSubscription )
func (OperationType) String ¶
func (t OperationType) String() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is a GQT parser.
type Selection ¶
type Selection Expression
Selection can be either of:
- *SelectionField
- *SelectionInlineFrag
- *SelectionMax
type SelectionField ¶
type SelectionField struct { LocRange Name Parent Expression ArgumentList SelectionSet Def *ast.FieldDefinition }
SelectionField is a field selection.
func (*SelectionField) GetLocation ¶
func (e *SelectionField) GetLocation() LocRange
func (*SelectionField) GetParent ¶
func (e *SelectionField) GetParent() Expression
func (*SelectionField) IsFloat ¶
func (e *SelectionField) IsFloat() bool
func (*SelectionField) MarshalYAML ¶
func (s *SelectionField) MarshalYAML() (any, error)
func (*SelectionField) TypeDesignation ¶
func (e *SelectionField) TypeDesignation() string
type SelectionInlineFrag ¶
type SelectionInlineFrag struct { LocRange Parent Expression TypeCondition TypeCondition SelectionSet }
SelectionInlineFrag is an inline fragment.
func (*SelectionInlineFrag) GetLocation ¶
func (e *SelectionInlineFrag) GetLocation() LocRange
func (*SelectionInlineFrag) GetParent ¶
func (e *SelectionInlineFrag) GetParent() Expression
func (*SelectionInlineFrag) IsFloat ¶
func (e *SelectionInlineFrag) IsFloat() bool
func (*SelectionInlineFrag) MarshalYAML ¶
func (s *SelectionInlineFrag) MarshalYAML() (any, error)
func (*SelectionInlineFrag) TypeDesignation ¶
func (e *SelectionInlineFrag) TypeDesignation() string
type SelectionMax ¶
type SelectionMax struct { LocRange Parent Expression Limit int Options SelectionSet }
SelectionMax is the max selection set.
func (*SelectionMax) GetLocation ¶
func (e *SelectionMax) GetLocation() LocRange
func (*SelectionMax) GetParent ¶
func (e *SelectionMax) GetParent() Expression
func (*SelectionMax) IsFloat ¶
func (e *SelectionMax) IsFloat() bool
func (*SelectionMax) MarshalYAML ¶
func (e *SelectionMax) MarshalYAML() (any, error)
func (*SelectionMax) TypeDesignation ¶
func (e *SelectionMax) TypeDesignation() string
type SelectionSet ¶
SelectionSet is a selection set.
func (SelectionSet) MarshalYAML ¶
func (s SelectionSet) MarshalYAML() (any, error)
type String ¶
type String struct { LocRange Parent Expression Value string TypeDef *ast.Definition }
String is a UTF-8 string value constant.
func (*String) GetLocation ¶
func (*String) GetParent ¶
func (e *String) GetParent() Expression
func (*String) MarshalYAML ¶
func (*String) TypeDesignation ¶
type True ¶
type True struct { LocRange Parent Expression TypeDef *ast.Definition }
True is a boolean value constant.
func (*True) GetLocation ¶
func (*True) GetParent ¶
func (e *True) GetParent() Expression
func (*True) MarshalYAML ¶
func (*True) TypeDesignation ¶
type TypeCondition ¶
type TypeCondition struct { LocRange TypeName string TypeDef *ast.Definition }
TypeCondition is the type condition inside an inline fragment.
func (TypeCondition) MarshalYAML ¶
func (c TypeCondition) MarshalYAML() (any, error)
type Variable ¶
type Variable struct { LocRange Name Parent Expression Declaration *VariableDeclaration }
Variable is a named value placeholder.
func (*Variable) GetLocation ¶
func (*Variable) GetParent ¶
func (e *Variable) GetParent() Expression
func (*Variable) MarshalYAML ¶
func (*Variable) TypeDesignation ¶
type VariableDeclaration ¶
type VariableDeclaration struct { LocRange Name string // References can be any of: // • *Argument // • *ObjectField References []Expression // Parent can be any of: // • *Argument // • *ObjectField Parent Expression }
func (*VariableDeclaration) GetInfo ¶
func (v *VariableDeclaration) GetInfo() ( schemaType *ast.Type, constr Expression, )
GetInfo returns the schema-type and constraint expression of the value behind the variable.