File: tracer.go

package info (click to toggle)
golang-github-graph-gophers-graphql-go 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,516 kB
  • sloc: sh: 373; javascript: 21; makefile: 5
file content (37 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// The tracer package provides tracing functionality.
package tracer

import (
	"context"

	"github.com/graph-gophers/graphql-go/errors"
	"github.com/graph-gophers/graphql-go/introspection"
)

type (
	QueryFinishFunc      = func([]*errors.QueryError)
	FieldFinishFunc      = func(*errors.QueryError)
	ValidationFinishFunc = func([]*errors.QueryError)
)

type Tracer interface {
	TraceQuery(ctx context.Context, queryString string, operationName string, variables map[string]interface{}, varTypes map[string]*introspection.Type) (context.Context, QueryFinishFunc)
	TraceField(ctx context.Context, label, typeName, fieldName string, trivial bool, args map[string]interface{}) (context.Context, FieldFinishFunc)
}

type ValidationTracer interface {
	TraceValidation(ctx context.Context) ValidationFinishFunc
}

// Deprecated: use [ValidationTracer] instead.
type LegacyValidationTracer interface {
	TraceValidation() func([]*errors.QueryError)
}

// Deprecated: use a Tracer which implements [ValidationTracer].
type LegacyNoopValidationTracer struct{}

// Deprecated: use a Tracer which implements [ValidationTracer].
func (LegacyNoopValidationTracer) TraceValidation() func([]*errors.QueryError) {
	return func(errs []*errors.QueryError) {}
}