middlewares

package
v0.0.0-...-c435964 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentUserKey = "currentUser"

CurrentUserKey is the key in context corresponding to cur user

View Source
const GinContextKey = "GinContextKey"

GinContextKey is the key in context corresponding to gin context

Variables

This section is empty.

Functions

func Auth

func Auth(db *pg.DB) gin.HandlerFunc

Auth authorizes a user

func GetCurrentUserFromCTX

func GetCurrentUserFromCTX(ctx context.Context) (*user.User, error)

GetCurrentUserFromCTX will be used in Resolvers to extract cur user

func GinContextFromContext

func GinContextFromContext(ctx context.Context) (*gin.Context, error)

GinContextFromContext returns the Gin context which is stored in native Context provided by stdlib, use it in congunction with GinContextToContext middleware which stores the Gin Context to native Context

func GinContextToContext

func GinContextToContext() gin.HandlerFunc

GinContextToContext adds Gin Context to the native Context provided by golang stdlib, which is then used by gqlgen resolvers

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL