cctx

package
v0.0.0-...-a28d39e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LangKey       = "lang"
	UserKey       = "user"
	ParametersKey = "parameters"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	fiber.Ctx
}

Context context

func New

func New(c fiber.Ctx) *Context

New new custom fiber context

func (*Context) BindValue

func (c *Context) BindValue(i interface{}, validate bool) error

BindValue bind value

func (*Context) ErrorBadRequest

func (c *Context) ErrorBadRequest(message string) *fiber.Error

ErrorBadRequest error bad request `400`

func (*Context) ErrorForbidden

func (c *Context) ErrorForbidden(message string) *fiber.Error

ErrorForbidden error forbidden `403`

func (*Context) ErrorNotFound

func (c *Context) ErrorNotFound(message string) *fiber.Error

ErrorNotFound error not found `404`

func (*Context) ErrorTooManyRequests

func (c *Context) ErrorTooManyRequests(message string) *fiber.Error

ErrorTooManyRequests error too many requests `429`

func (*Context) ErrorUnauthorized

func (c *Context) ErrorUnauthorized(message string) *fiber.Error

ErrorUnauthorized error unauthorized `401`

func (*Context) GetClaims

func (c *Context) GetClaims() (*models.TokenClaims, error)

GetClaims get user claims

func (*Context) GetClientIP

func (c *Context) GetClientIP() string

GetClientIP get client ip

func (*Context) GetClientUserAgent

func (c *Context) GetClientUserAgent() string

GetClientUserAgent get client user agent

func (*Context) GetLanguage

func (c *Context) GetLanguage() config.Language

GetLanguage get language

func (*Context) GetRelayDatabase

func (c *Context) GetRelayDatabase() *gorm.DB

GetRelayDatabase get connection database `ralay`

func (*Context) GetUserID

func (c *Context) GetUserID() string

GetUserID get user id claims

func (*Context) GetUserLevel

func (c *Context) GetUserLevel() string

GetUserLevel get user level claims

func (*Context) Localization

func (c *Context) Localization(i interface{}, depth int)

Localization localization

func (*Context) NewError

func (c *Context) NewError(code int, message string) *fiber.Error

NewError new custom fiber error

func (*Context) PathParser

func (c *Context) PathParser(i interface{}, depth int)

PathParser parse path param

func (*Context) TrimSpace

func (c *Context) TrimSpace(i interface{}, depth int)

TrimSpace trim space

func (*Context) Validate

func (c *Context) Validate(i interface{}) error

Validate validate

type Localizer

type Localizer interface {
	WithLocale(c *Context)
	GetLanguage() config.Language
}

Localizer localizer

Jump to

Keyboard shortcuts

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