Versions in this module Expand all Collapse all v1 v1.41.0 Jun 27, 2022 Changes in this version + const DefaultFlushIntervalInMilliseconds + var DefaultComplexityCalculator = defaultComplexityCalculator + var ErrEmptyRequest = errors.New("the provided request is empty") + var ErrNilSchema = errors.New("the provided schema is nil") + func CreateTypeFieldArgumentsLookupMap(typeFieldArgs []TypeFieldArguments) map[TypeFieldLookupKey]TypeFieldArguments + func UnmarshalHttpRequest(r *http.Request, request *Request) error + func UnmarshalRequest(reader io.Reader, request *Request) error + type ComplexityCalculator interface + Calculate func(operation, definition *ast.Document) (ComplexityResult, error) + type ComplexityResult struct + Complexity int + Depth int + Errors Errors + NodeCount int + PerRootField []FieldComplexityResult + type DataSourceGraphqlOptions struct + Hooks *datasource.Hooks + HttpClient *http.Client + WhitelistedSchemes []string + type DataSourceHttpJsonOptions struct + Hooks *datasource.Hooks + HttpClient *http.Client + WhitelistedSchemes []string + type DefaultFieldsValidator struct + func (d DefaultFieldsValidator) Validate(request *Request, schema *Schema, restrictions []Type) (RequestFieldsValidationResult, error) + func (d DefaultFieldsValidator) ValidateByFieldList(request *Request, schema *Schema, restrictionList FieldRestrictionList) (RequestFieldsValidationResult, error) + type EngineResultWriter struct + func NewEngineResultWriter() EngineResultWriter + func NewEngineResultWriterFromBuffer(buf *bytes.Buffer) EngineResultWriter + func (e *EngineResultWriter) AsHTTPResponse(status int, headers http.Header) *http.Response + func (e *EngineResultWriter) Bytes() []byte + func (e *EngineResultWriter) Flush() + func (e *EngineResultWriter) Len() int + func (e *EngineResultWriter) Read(p []byte) (n int, err error) + func (e *EngineResultWriter) Reset() + func (e *EngineResultWriter) SetFlushCallback(flushCb func(data []byte)) + func (e *EngineResultWriter) String() string + func (e *EngineResultWriter) Write(p []byte) (n int, err error) + type EngineV2Configuration struct + func NewEngineV2Configuration(schema *Schema) EngineV2Configuration + func (e *EngineV2Configuration) AddDataSource(dataSource plan.DataSourceConfiguration) + func (e *EngineV2Configuration) AddFieldConfiguration(fieldConfig plan.FieldConfiguration) + func (e *EngineV2Configuration) DataSources() []plan.DataSourceConfiguration + func (e *EngineV2Configuration) EnableDataLoader(enable bool) + func (e *EngineV2Configuration) FieldConfigurations() plan.FieldConfigurations + func (e *EngineV2Configuration) SetDataSources(dataSources []plan.DataSourceConfiguration) + func (e *EngineV2Configuration) SetFieldConfigurations(fieldConfigs plan.FieldConfigurations) + func (e *EngineV2Configuration) SetWebsocketBeforeStartHook(hook WebsocketBeforeStartHook) + type ErrorPath struct + func (e *ErrorPath) Len() int + func (e *ErrorPath) MarshalJSON() ([]byte, error) + func (e *ErrorPath) String() string + type Errors interface + Count func() int + ErrorByIndex func(i int) error + WriteResponse func(writer io.Writer) (n int, err error) + type ExecutionEngine struct + func NewExecutionEngine(logger abstractlogger.Logger, schema *Schema, ...) (*ExecutionEngine, error) + func (e *ExecutionEngine) AddDataSource(name string, plannerFactoryFactory datasource.PlannerFactoryFactory) error + func (e *ExecutionEngine) AddGraphqlDataSource(name string) error + func (e *ExecutionEngine) AddGraphqlDataSourceWithOptions(name string, options DataSourceGraphqlOptions) error + func (e *ExecutionEngine) AddHttpJsonDataSource(name string) error + func (e *ExecutionEngine) AddHttpJsonDataSourceWithOptions(name string, options DataSourceHttpJsonOptions) error + func (e *ExecutionEngine) Execute(ctx context.Context, operation *Request, options ExecutionOptions) (*ExecutionResult, error) + func (e *ExecutionEngine) ExecuteWithWriter(ctx context.Context, operation *Request, writer io.Writer, ...) error + func (e *ExecutionEngine) NewExecutionHandler() *execution.Handler + type ExecutionEngineV2 struct + func NewExecutionEngineV2(ctx context.Context, logger abstractlogger.Logger, ...) (*ExecutionEngineV2, error) + func (e *ExecutionEngineV2) Execute(ctx context.Context, operation *Request, writer resolve.FlushWriter, ...) error + func (e *ExecutionEngineV2) GetWebsocketBeforeStartHook() WebsocketBeforeStartHook + type ExecutionOptions struct + ExtraArguments json.RawMessage + type ExecutionOptionsV2 func(ctx *internalExecutionContext) + func WithAdditionalHttpHeaders(headers http.Header, excludeByKeys ...string) ExecutionOptionsV2 + func WithAfterFetchHook(hook resolve.AfterFetchHook) ExecutionOptionsV2 + func WithBeforeFetchHook(hook resolve.BeforeFetchHook) ExecutionOptionsV2 + type ExecutionResult struct + func SchemaIntrospection(schema *Schema) (*ExecutionResult, error) + func (r *ExecutionResult) Buffer() *bytes.Buffer + func (r *ExecutionResult) GetAsHTTPResponse() (res *http.Response) + type Extractor struct + func NewExtractor() *Extractor + func (e *Extractor) ExtractFieldsFromRequest(request *Request, schema *Schema, report *operationreport.Report, ...) + type FederationEngineConfigFactory struct + func NewFederationEngineConfigFactory(dataSourceConfigs []graphqlDataSource.Configuration, ...) *FederationEngineConfigFactory + func (f *FederationEngineConfigFactory) EngineV2Configuration() (conf EngineV2Configuration, err error) + func (f *FederationEngineConfigFactory) MergedSchema() (*Schema, error) + func (f *FederationEngineConfigFactory) SetMergedSchemaFromString(mergedSchema string) (err error) + type FederationEngineConfigFactoryOption func(options *federationEngineConfigFactoryOptions) + func WithFederationHttpClient(client *http.Client) FederationEngineConfigFactoryOption + type FieldComplexityResult struct + Alias string + Complexity int + Depth int + FieldName string + NodeCount int + TypeName string + type FieldRestrictionList struct + Kind FieldRestrictionListKind + Types []Type + type FieldRestrictionListKind int + const AllowList + const BlockList + type FieldRestrictionValidator interface + ValidateByFieldList func(request *Request, schema *Schema, restrictionList FieldRestrictionList) (RequestFieldsValidationResult, error) + type NormalizationResult struct + Errors Errors + Successful bool + type OperationType ast.OperationType + const OperationTypeMutation + const OperationTypeQuery + const OperationTypeSubscription + const OperationTypeUnknown + type ProxyEngineConfigFactory struct + func NewProxyEngineConfigFactory(schema *Schema, proxyUpstreamConfig ProxyUpstreamConfig, ...) *ProxyEngineConfigFactory + func (p *ProxyEngineConfigFactory) EngineV2Configuration() (EngineV2Configuration, error) + type ProxyEngineConfigFactoryOption func(options *proxyEngineConfigFactoryOptions) + func WithProxyHttpClient(client *http.Client) ProxyEngineConfigFactoryOption + type ProxyUpstreamConfig struct + Method string + StaticHeaders http.Header + URL string + type Request struct + OperationName string + Query string + Variables json.RawMessage + func (r *Request) CalculateComplexity(complexityCalculator ComplexityCalculator, schema *Schema) (ComplexityResult, error) + func (r *Request) IsIntrospectionQuery() (result bool, err error) + func (r *Request) IsNormalized() bool + func (r *Request) Normalize(schema *Schema) (result NormalizationResult, err error) + func (r *Request) OperationType() (OperationType, error) + func (r *Request) SetHeader(header http.Header) + func (r *Request) ValidateFieldRestrictions(schema *Schema, restrictedFieldsList FieldRestrictionList, ...) (RequestFieldsValidationResult, error) + func (r *Request) ValidateForSchema(schema *Schema) (result ValidationResult, err error) + func (r *Request) ValidateRestrictedFields(schema *Schema, restrictedFields []Type) (RequestFieldsValidationResult, error) + func (r Request) Print(writer io.Writer) (n int, err error) + type RequestError struct + Locations []graphqlerrors.Location + Message string + Path ErrorPath + func (o RequestError) Error() string + func (o RequestError) MarshalJSON() ([]byte, error) + type RequestErrors []RequestError + func RequestErrorsFromError(err error) RequestErrors + func RequestErrorsFromOperationReport(report operationreport.Report) (errors RequestErrors) + func (o RequestErrors) Count() int + func (o RequestErrors) Error() string + func (o RequestErrors) ErrorByIndex(i int) error + func (o RequestErrors) WriteResponse(writer io.Writer) (n int, err error) + type RequestFields map[string]struct + type RequestFieldsValidationResult struct + Errors Errors + Valid bool + type RequestFieldsValidator interface + Validate func(request *Request, schema *Schema, restrictions []Type) (RequestFieldsValidationResult, error) + type RequestTypes map[string]RequestFields + type Response struct + Errors Errors + func (r Response) Marshal() ([]byte, error) + type Schema struct + func NewSchemaFromReader(reader io.Reader) (*Schema, error) + func NewSchemaFromString(schema string) (*Schema, error) + func (s *Schema) Document() []byte + func (s *Schema) GetAllFieldArguments(skipFieldFuncs ...SkipFieldFunc) []TypeFieldArguments + func (s *Schema) GetAllNestedFieldChildrenFromTypeField(typeName string, fieldName string, skipFieldFuncs ...SkipFieldFunc) []TypeFields + func (s *Schema) HasMutationType() bool + func (s *Schema) HasQueryType() bool + func (s *Schema) HasSubscriptionType() bool + func (s *Schema) Hash() (uint64, error) + func (s *Schema) Input() []byte + func (s *Schema) IntrospectionResponse(out io.Writer) error + func (s *Schema) IsNormalized() bool + func (s *Schema) MutationTypeName() string + func (s *Schema) Normalize() (result NormalizationResult, err error) + func (s *Schema) QueryTypeName() string + func (s *Schema) SubscriptionTypeName() string + func (s *Schema) Validate() (result ValidationResult, err error) + type SchemaValidationError struct + Message string + func (s SchemaValidationError) Error() string + type SchemaValidationErrors []SchemaValidationError + func (s SchemaValidationErrors) Count() int + func (s SchemaValidationErrors) Error() string + func (s SchemaValidationErrors) ErrorByIndex(i int) error + func (s SchemaValidationErrors) WriteResponse(writer io.Writer) (n int, err error) + type SkipFieldFunc func(typeName, fieldName string, definition ast.Document) bool + func NewIsDataSourceConfigV2RootFieldSkipFunc(dataSources []plan.DataSourceConfiguration) SkipFieldFunc + func NewSkipReservedNamesFunc() SkipFieldFunc + type Type struct + Fields []string + Name string + type TypeFieldArguments struct + ArgumentNames []string + FieldName string + TypeName string + type TypeFieldLookupKey string + func CreateTypeFieldLookupKey(typeName string, fieldName string) TypeFieldLookupKey + type TypeFields struct + FieldNames []string + TypeName string + type ValidationResult struct + Errors Errors + Valid bool + func ValidateSchemaString(schema string) (result ValidationResult, err error) + type WebsocketBeforeStartHook interface + OnBeforeStart func(reqCtx context.Context, operation *Request) error