middleware

package
v0.0.0-...-b699e3b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SessionIDKey = "user_session"

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired(s *Session) gin.HandlerFunc

func Logger

func Logger(logger *zap.Logger) gin.HandlerFunc

func Recovery

func Recovery(logger *zap.Logger) gin.HandlerFunc

Recovery returns a gin.HandlerFunc (middleware) that recovers from any panics and logs requests using uber-go/zap. All errors are logged using zap.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large.

Types

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a session store.

func NewStore

func NewStore(timeout time.Duration) *Session

func (*Session) Create

func (s *Session) Create(data interface{}) string

func (*Session) Delete

func (s *Session) Delete(id string)

func (*Session) Exists

func (s *Session) Exists(id string) bool

func (*Session) Get

func (s *Session) Get(id string) interface{}

func (*Session) Update

func (s *Session) Update(id string, data interface{}) error

Jump to

Keyboard shortcuts

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