Documentation ¶
Index ¶
- Variables
- func FromGlobalID(globalID string) *relay.ResolvedGlobalID
- func GetUserFromCookie(c Context) (*models.User, error)
- func GlobalIDField(name string) *graphql.Field
- func GraphqlHandler(config handler.Config, w http.ResponseWriter, r *http.Request)
- func HandlerFunc(w http.ResponseWriter, r *http.Request, resp events.APIGatewayProxyResponse)
- func NewContext(c Context) context.Context
- func NewHandler(config handler.Config, e events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
- func RemoveToken(c Context)
- func ResolveConnection(p graphql.ResolveParams, c Context, ...) (interface{}, error)
- func SetToken(c Context, u *models.User) (token string, err error)
- type Context
- func (c *Context) Bind(s interface{}, cb func(err validator.FieldError) string) (events.APIGatewayProxyResponse, error)
- func (c *Context) EnsureIsAuthorized(cb func(*models.User) bool)
- func (c *Context) JSON(code int, v interface{}) (events.APIGatewayProxyResponse, error)
- func (c *Context) Panic(code int, message string)
- func (c *Context) Param(key string) string
- func (c *Context) Redirect(code int, url string) (events.APIGatewayProxyResponse, error)
- func (c *Context) Validate(inputMap map[string]interface{}, s interface{}, ...)
- type Cursor
Constants ¶
This section is empty.
Variables ¶
View Source
var Validator = validator.New()
Validator instance
Functions ¶
func FromGlobalID ¶
func FromGlobalID(globalID string) *relay.ResolvedGlobalID
FromGlobalID takes the "global ID" created by toGlobalID, and returns the type name and ID used to create it.
func GetUserFromCookie ¶
GetUserFromCookie get user from cookie
func GraphqlHandler ¶
GraphqlHandler create graphql handler
func HandlerFunc ¶
func HandlerFunc(w http.ResponseWriter, r *http.Request, resp events.APIGatewayProxyResponse)
HandlerFunc http HandlerFun
func NewHandler ¶
func NewHandler(config handler.Config, e events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)
NewHandler create graphql handler from APIGatewayProxyRequest
Types ¶
type Context ¶
type Context struct { Request *http.Request Response http.ResponseWriter User *models.User Params map[string]string Host string Binder binding.Binding }
Context graphql context
func FromContext ¶
FromContext convert context.Context to Context
func (*Context) Bind ¶
func (c *Context) Bind(s interface{}, cb func(err validator.FieldError) string) (events.APIGatewayProxyResponse, error)
Bind struct
func (*Context) EnsureIsAuthorized ¶
EnsureIsAuthorized user is authorized
func (*Context) JSON ¶
func (c *Context) JSON(code int, v interface{}) (events.APIGatewayProxyResponse, error)
JSON APIGatewayProxyResponse
Click to show internal directories.
Click to hide internal directories.