Documentation ¶
Index ¶
- Variables
- func AuthErrorHandler(w http.ResponseWriter, ctx context.Context, err error)
- func CompressionMiddleware(next http.Handler) http.Handler
- func Errorf(ctx context.Context, format string, args ...interface{}) *errors.QueryError
- func IsDeadlineExceededError(err error) bool
- func LoggingMiddleware(next http.Handler) http.Handler
- func MergeSchemas(first string, second string) string
- func MustProtoToOpaqueCursor(entity proto.Message, entityTag string) string
- func NewCORSMiddleware() mux.MiddlewareFunc
- func RegisterSchema(schemaPrefix, schemaName string, schemaData []byte)
- func Status(ctx context.Context, code codes.Code, message string) *errors.QueryError
- func UnmarshalCursorProto(opaqued string, entity proto.Message) error
- func UnwrapError(ctx context.Context, err error) *errors.QueryError
- type CursorDecoder
- type EndpointServer
- type Keyable
- type MultiRouterClient
- type OpaqueProtoCursorDecoder
- type Paginator
- type Pagineable
- type PagineableStrings
- type SchemaFactory
- type SchemaSelector
- type Schemas
- type Server
- type Tracer
- func (t *Tracer) TraceField(ctx context.Context, label, typeName, fieldName string, trivial bool, ...) (context.Context, gqtrace.TraceFieldFinishFunc)
- func (*Tracer) TraceMutation(ctx context.Context, root selected.Field) (context.Context, gqtrace.TraceOperationFinishFunc)
- func (*Tracer) TraceQuery(ctx context.Context, root selected.Field) (context.Context, gqtrace.TraceOperationFinishFunc)
- func (t *Tracer) TraceRequest(ctx context.Context, queryString string, opType string, operationName string, ...) (context.Context, gqtrace.TraceRequestFinishFunc)
- func (*Tracer) TraceSubscription(ctx context.Context, root selected.Field) (context.Context, gqtrace.TraceOperationFinishFunc)
Constants ¶
This section is empty.
Variables ¶
var IdentityCursorDecoder = &identityCursorDecoder{}
var SchemaRegistry = map[string][]byte{}
Functions ¶
func AuthErrorHandler ¶
func AuthErrorHandler(w http.ResponseWriter, ctx context.Context, err error)
func Errorf ¶
func Errorf(ctx context.Context, format string, args ...interface{}) *errors.QueryError
func IsDeadlineExceededError ¶
IsDeadlineExceededError checks wheter error is `context.DeadlineExceeded` or a gRPC RPC error for which the code is `codes.DeadlineExceeded`.
func MergeSchemas ¶
MergeSchemas is a poor man way of merging some specific GraphQL types together to form a single schemas.
The algorithm simply reads the schema and look for the pattern `type Query {(.*)}` and `type Subscription {(.*)}`, collecting them along the way and removing from the actual buffer.
Once the full schema has been processed, we simply append a `type Query { ... }` node with the content (regexp sub-match) of the various collected queries in the first pass, same for `Subscription`.
This creates a final `Query` and `Subscription` type of the collected merged elements.
**Important** This is regexp based, so the current drawback of this technique
is that the inner sub-match content must not contain a `{ }` pair. This is easy to achieve and maintain.
func MustProtoToOpaqueCursor ¶
func NewCORSMiddleware ¶
func NewCORSMiddleware() mux.MiddlewareFunc
func RegisterSchema ¶
func UnwrapError ¶
func UnwrapError(ctx context.Context, err error) *errors.QueryError
Types ¶
type CursorDecoder ¶
type EndpointServer ¶
type EndpointServer struct {
// contains filtered or unexported fields
}
func NewEndpointServer ¶
func NewEndpointServer(schema *graphql.Schema, authenticator authenticator.Authenticator, shut *shutter.Shutter) *EndpointServer
func (*EndpointServer) Execute ¶
func (s *EndpointServer) Execute(req *pbgraphql.Request, stream pbgraphql.GraphQL_ExecuteServer) error
type MultiRouterClient ¶
func NewMultiRouterClient ¶
func NewMultiRouterClient(v1Client pbsearch.RouterClient, v2Client pbsearch.RouterClient) *MultiRouterClient
func (*MultiRouterClient) StreamMatches ¶
func (m *MultiRouterClient) StreamMatches(ctx context.Context, in *pbsearch.RouterRequest, opts ...grpc.CallOption) (pbsearch.Router_StreamMatchesClient, error)
type OpaqueProtoCursorDecoder ¶
func NewOpaqueProtoCursorDecoder ¶
func NewOpaqueProtoCursorDecoder(factory func() proto.Message) OpaqueProtoCursorDecoder
type Paginator ¶
type Paginator struct { HasPreviousPage bool HasNextPage bool // contains filtered or unexported fields }
func NewPaginator ¶
func (*Paginator) Paginate ¶
func (p *Paginator) Paginate(results Pagineable) Pagineable
Paginate takes a full slice of results and returns a paginated view of them, for example the elements after a given key or the elements in-between an after and before key.
type Pagineable ¶
type Pagineable interface { Length() int IsEqual(index int, key string) bool Append(slice Pagineable, index int) Pagineable }
type PagineableStrings ¶
type PagineableStrings []string
func (PagineableStrings) Append ¶
func (p PagineableStrings) Append(slice Pagineable, index int) Pagineable
func (PagineableStrings) Length ¶
func (p PagineableStrings) Length() int
type SchemaFactory ¶
type SchemaSelector ¶
type SchemaSelector interface { SchemaID() schemaID String() string }
func WithAlpha ¶
func WithAlpha() SchemaSelector
type Schemas ¶
type Schemas struct {
// contains filtered or unexported fields
}
func NewSchemas ¶
func (*Schemas) GetSchema ¶
func (s *Schemas) GetSchema(selectors ...SchemaSelector) *graphql.Schema
type Server ¶
type Server struct { *shutter.Shutter DataIntegrityProofSecret string // contains filtered or unexported fields }
func NewServer ¶
func NewServer( grpcListenAddr string, httpListenAddr string, protocol string, networkID string, overrideTraceID bool, authenticator authenticator.Authenticator, metering dmetering.Metering, schemas *Schemas, dataIntegrityProofSecret string, jwtIssuerURL string, apiKey string, predfinedGraphqlExamples []*static.GraphqlExample, ) *Server
type Tracer ¶
type Tracer struct { }