Documentation ¶
Index ¶
- Constants
- func AuthMiddleware(policy security.Policy) gin.HandlerFunc
- func BindHook(c *gin.Context, i interface{}) error
- func GetLogger(c *gin.Context) *logrus.Entry
- func HasOne(roles ...security.Role) gin.HandlerFunc
- func LoggingMiddleware(logHeaders []string, log logrus.FieldLogger) gin.HandlerFunc
- func PingHandler(db *sql.DB) func(c *gin.Context) (string, error)
- func RecoveryWithLogger(log logrus.FieldLogger) gin.HandlerFunc
- func RenderHookWrapper(hook tonic.RenderHook) tonic.RenderHook
- func VersionHandler(version string) func(*gin.Context) (string, error)
- type MediaResource
Constants ¶
View Source
const ( KeyRoles = "roles" KeyLogEntry = "logger" )
Gin context keys
Variables ¶
This section is empty.
Functions ¶
func AuthMiddleware ¶
func AuthMiddleware(policy security.Policy) gin.HandlerFunc
AuthMiddleware returns a middleware that populate the Gin Context with security data
func GetLogger ¶
GetLogger returns the request logger from the gin context, nil if it does not exist
func HasOne ¶
func HasOne(roles ...security.Role) gin.HandlerFunc
HasOne returns a gin handler that checks the request against the given role
func LoggingMiddleware ¶
func LoggingMiddleware(logHeaders []string, log logrus.FieldLogger) gin.HandlerFunc
LoggingMiddleware logs before and after incoming gin requests
func PingHandler ¶
PingHandler provides monitoring status on a rest endpoint
func RecoveryWithLogger ¶
func RecoveryWithLogger(log logrus.FieldLogger) gin.HandlerFunc
RecoveryWithLogger returns a middleware for a given logger that recovers from any panics and writes a 500 if there was one.
func RenderHookWrapper ¶
func RenderHookWrapper(hook tonic.RenderHook) tonic.RenderHook
RenderHookWrapper hook for lhasa, override default one
Types ¶
type MediaResource ¶
MediaResource defines a media resource behaviour
Click to show internal directories.
Click to hide internal directories.