helper

package
v0.0.0-...-7d0be85 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePass

func ComparePass(h string, p string) bool

func VerifyToken

func VerifyToken(context *gin.Context) (interface{}, error)

Types

type Error

type Error interface {
	Message() string
	Status() int
	Type() string
}

func BadRequest

func BadRequest(message string) Error

func GenerateToken

func GenerateToken(id uint, email string) (string, Error)

func GetIdParam

func GetIdParam(context *gin.Context, idName string) (uint, Error)

func HashPass

func HashPass(p string) (string, Error)

func InternalServerError

func InternalServerError(message string) Error

func NewError

func NewError(message string, status int, ErrorType string) Error

func NotFound

func NotFound(message string) Error

func ParseError

func ParseError(err error) Error

func Unautorized

func Unautorized(message string) Error

func UnprocessibleEntity

func UnprocessibleEntity(message string) Error

type ErrorResponse

type ErrorResponse struct {
	ErrorMessage string `json:"message"`
	ErrorStatus  int    `json:"status"`
	ErrorType    string `json:"error"`
}

func (*ErrorResponse) Message

func (e *ErrorResponse) Message() string

func (*ErrorResponse) Status

func (e *ErrorResponse) Status() int

func (*ErrorResponse) Type

func (e *ErrorResponse) Type() string

Jump to

Keyboard shortcuts

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