helper

package
v0.0.0-...-b6cb40f Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FORBIDDEN         = "forbidden"
	UNAUTHORIZED      = "Unauthorized"
	SUCCEEDPOSTDATA   = "Succeed to POST data"
	SUCCEEDGETDATA    = "Succeed to GET data"
	SUCCEEDPUTDATA    = "Succeed to PUT data"
	SUCCEEDDELETEDATA = "Succeed to DELETE data"
	FAILEDPOSTDATA    = "Faild to POST data"
	FAILEDGETDATA     = "Faild to GET  data"
	FAILEDPUTDATA     = "Faild to PUT data"
	FAILEDDELETEDATA  = "Faild to DELETE data"
)

constants for massage in HTTP response

Variables

View Source
var (
	ErrUnsupportedDriver          = errors.New("unsupported database driver")
	ErrDataAlreadyExist           = errors.New("data already exists")
	ErrUnsupportedTokenType       = errors.New("unsupported token type")
	ErrExpiredToken               = errors.New("token has expired")
	ErrInvalidToken               = errors.New("token is invalid")
	ErrDataNotFound               = errors.New("data not found")
	ErrUnauthorized               = errors.New("unauthorized")
	ErrForbidden                  = errors.New("forbidden")
	ErrInsufficientPermission     = errors.New("only admin can access this resource")
	ErrEmptyAuthorizationHeader   = errors.New("empty authorization header")
	ErrInvalidAuthorizationHeader = errors.New("invalid authorization header")
	ErrInvalidAuthorizationType   = errors.New("invalid authorization type")
)

ERROR Massage

Functions

func ComparePassword

func ComparePassword(password, hashPassword string) error

func HashPassword

func HashPassword(password string) (string, error)

func ParseTime

func ParseTime(date string) (time.Time, error)

func Response

func Response(ctx *fiber.Ctx, code int, status bool, message string, err error, data any) error

Types

type JSONResponse

type JSONResponse struct {
	Status  bool     `json:"status"`
	Massage string   `json:"message"`
	Errors  []string `json:"errors"`
	Data    any      `json:"data"`
}

Jump to

Keyboard shortcuts

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