graphql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GraphQLParser

type GraphQLParser struct {

	// TargetParam is the paramter name for the GraphQL query ( default: "query")
	TargetParam string

	// ParseVariables enables parsing the "variables" parameter as JSON
	ParseVariables bool

	// ParseOperationName enable parsing the <operation_name> parameter
	ParseOperationName bool

	// Strict validate using the RFC
	StrictValidation bool
}

GraphQLParser extracts and validates GraphQL query from URL params

func NewGraphQLParser

func NewGraphQLParser() *GraphQLParser

NewGraphQLParser crates a parser with default setting

func (*GraphQLParser) Name

func (p *GraphQLParser) Name() string

Name returns the parser indentifier

func (*GraphQLParser) Parse

func (p *GraphQLParser) Parse(scanner *rfcquery.Scanner) (any, error)

type GraphQLQuery

type GraphQLQuery struct {
	// The query document
	Query string

	// Optional Operation name to support multiple operations in document
	OperationName string

	// Optional variables JSON object
	Variables map[string]any

	// Raw tokens for metadata
	QueryTokens     rfcquery.TokenSlice
	VariablesTokens rfcquery.TokenSlice
	OperationTokens rfcquery.TokenSlice
}

GraphQLQuery represents a GraphQL request from URL parameters

func ParseGraphQLQuery

func ParseGraphQLQuery(query string) (*GraphQLQuery, error)

Jump to

Keyboard shortcuts

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