helper

package
v0.0.0-...-c7d2356 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 ComparePassword

func ComparePassword(p string, h string) bool

Types

type Error

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

func BadRequest

func BadRequest(message string) Error

func GenerateToken

func GenerateToken(id int, email string, role string) (string, Error)

func GetIdParam

func GetIdParam(context *gin.Context, paramName string) (int, Error)

func HashPassword

func HashPassword(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 Unauthorized

func Unauthorized(message string) Error

func UnprocessibleEntity

func UnprocessibleEntity(message string) Error

func VerifyToken

func VerifyToken(context *gin.Context) (interface{}, 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