Documentation ¶
Index ¶
- func Access(ctx context.Context, obj interface{}, next graphql.Resolver, scope string, ...) (interface{}, error)
- func AnonInternal(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error)
- func EmailRecover(ctx context.Context, _origErr interface{}) error
- func Internal(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error)
- func Private(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error)
- func RemoteAddr(ctx context.Context) string
- type Server
- func (server *Server) Router() chi.Router
- func (server *Server) Run()
- func (server *Server) WithDefaultMiddleware() *Server
- func (server *Server) WithMiddleware(middlewares ...func(http.Handler) http.Handler) *Server
- func (server *Server) WithQueues(queues ...*work.Queue) *Server
- func (server *Server) WithSchema(schema graphql.ExecutableSchema, scopes []string) *Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnonInternal ¶
func EmailRecover ¶
Provides a graphql.RecoverFunc which will print the stack trace, and if debug mode is not enabled, email it to the administrator.
func RemoteAddr ¶
RemoteAddr returns the remote address for this context. It is guaranteed to be valid input for `net.ParseIP()`.
Types ¶
type Server ¶
type Server struct { Schema graphql.ExecutableSchema MaxComplexity int // contains filtered or unexported fields }
func ForContext ¶
func (*Server) Router ¶
func (server *Server) Router() chi.Router
Returns the chi Router being used for this sever.
func (*Server) WithDefaultMiddleware ¶
Adds the default middleware to this server, including:
- Configuration middleware - PostgresSQL connection pool - Redis connection - Authentication middleware - An email queue - Standard rigging: logging, x-real-ip, instrumentation, etc
func (*Server) WithMiddleware ¶
Add user-defined middleware to the server
func (*Server) WithQueues ¶
Add dowork task queues for this server to manage
func (*Server) WithSchema ¶
func (server *Server) WithSchema( schema graphql.ExecutableSchema, scopes []string) *Server
Adds a GraphQL schema for this server. The second parameter shall be the list of scopes, as strings, which are supported by this schema. This function configures routes for the router; all middlewares must be configured before this is called.