contextutil

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: LGPL-2.1 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MWContext

func MWContext() echo.MiddlewareFunc

MWContext is a middleware that injects custom context into echo.Context

Types

type Context

type Context interface {
	GetContext() context.Context
	AuthUser() *types.AuthUser
	RealIP() string
	UserAgent() string
}

Context is a custom context interface

func NewContext

func NewContext(c echo.Context) Context

NewContext returns new custom context

type HTTPContext

type HTTPContext struct {
	echo.Context
	// contains filtered or unexported fields
}

HTTPContext is a custom context

func (*HTTPContext) AuthUser

func (h *HTTPContext) AuthUser() *types.AuthUser

AuthUser returns authenticated user info

func (*HTTPContext) GetContext

func (h *HTTPContext) GetContext() context.Context

GetContext returns context

func (*HTTPContext) RealIP

func (h *HTTPContext) RealIP() string

RealIP returns real ip address

func (*HTTPContext) SetAuthUser

func (h *HTTPContext) SetAuthUser()

SetAuthUser sets authenticated user info

func (*HTTPContext) UserAgent

func (h *HTTPContext) UserAgent() string

UserAgent returns user agent

Jump to

Keyboard shortcuts

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