utils

package
v0.0.0-...-e8bea81 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJWTToken

func GenerateJWTToken(user *models.User, config *config.Config) (string, error)

func GetIPAddress

func GetIPAddress(c echo.Context) string

Get user ip address

func GetRequestCtx

func GetRequestCtx(c echo.Context) context.Context

Get context with request id

func GetRequestID

func GetRequestID(c echo.Context) string

Get request id from echo context

func LogResponseError

func LogResponseError(ctx echo.Context, err error)

Error response with logging error for echo context

func ReadRequest

func ReadRequest(ctx echo.Context, request interface{}) error

Read request body and validate

func ValidateStruct

func ValidateStruct(ctx context.Context, s interface{}) error

Validate struct fields

Types

type Claims

type Claims struct {
	Email string `json:"email"`
	ID    string `json:"id"`
	jwt.RegisteredClaims
}

JWT Claims struct

type ReqIDCtxKey

type ReqIDCtxKey struct{}

ReqIDCtxKey is a key used for the Request ID in context

type UserCtxKey

type UserCtxKey struct{}

UserCtxKey is a key used for the User object in the context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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