api

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

View Source
const (
	ROLE_USER      = 1
	ROLE_MODERATOR = 2
	ROLE_ADMIN     = 3
)
View Source
const RememberTokenBytes = 32

Variables

View Source
var (
	ERR_NOT_MATCH_LOGIN = errors.New("ALFA-001")

	ERR_NOT_FOUND       = errors.New("ALFA-002")
	ERR_USERID_REQUIRED = errors.New("ALFA-003")
	ERR_ID_INVALID      = errors.New("ALFA-004")

	ERR_MAIL_REQUIRED        = errors.New("ALFA-005")
	ERR_MAIL_IS_N0T_VALID    = errors.New("ALFA-006")
	ERR_MAIL_IS_TAKEN        = errors.New("ALFA-007")
	ERR_MAIL_INVALID         = errors.New("ALFA-008")
	ERR_MAIL_NOT_EXIST       = errors.New("ALFA-009")
	ERR_NOT_FOUND_MODEL      = "models: resource not found"
	ERR_INVALID_LITERAL_JSON = errors.New("EOF")
	ERR_PSSWD_INCORRECT      = errors.New("ALFA-010")
	ERR_PSSWD_TOO_SHORT      = errors.New("ALFA-011")
	ERR_PSSWD_REQUIRED       = errors.New("ALFA-012")
	ERR_PSSWD_SAME_RESET     = errors.New("ALFA-003")

	ERR_REMMEMBER_TOO_SHOT = errors.New("ALFA-014")
	ERR_REMMEMBER_REQUIRED = errors.New("ALFA-015")

	ERR_PSSWD_RESET_TOKEN_EXPIRED    = errors.New("ALFA-016")
	ERR_PSSWD_RESET_TOKEN_DUPLICATED = errors.New("ALFA-017")

	ERR_JWT_TOKEN_EXPIRED      = errors.New("ALFA-018")
	ERR_JWT_CLAIMS_INVALID     = errors.New("ALFA-019")
	ERR_JWT_TOKEN_REQUIRED     = errors.New("ALFA-020")
	ERR_NOT_ENOUGH_PERMISSIONS = errors.New("ALFA-021")

	ERR_INVALID_JSON = errors.New("ALFA-022")

	ERR_NOT_SAME_USER = errors.New("ALFA-023")

	ERR_UNDEFINED_TYPE_TRANSACTION = errors.New("BRAVO-001")
)
View Source
var (
	Warning *log.Logger
	Info    *log.Logger
	Debug   *log.Logger
	Error   *log.Logger
	Gin     *log.Logger
	Stats   *log.Logger
)

Functions

func Bytes

func Bytes(n int) ([]byte, error)

func EnableDebug

func EnableDebug(activated bool)

EnableDebug use this function to enable/disable debug POST InitLog

func InitLog

func InitLog(debugEnabled bool, desiredLogRoute, version string)

InitLog initialize loggers with route and colors (predefined)

func NBytes

func NBytes(base64String string) (int, error)

func PrintStats

func PrintStats()

func PrintVersion

func PrintVersion(engine string)

PrintVersion print engine with version example "CERBERUS V1.0.0"

func RememberToken

func RememberToken() (string, error)

func String

func String(nBytes int) (string, error)

Types

type HMAC

type HMAC struct {
	// contains filtered or unexported fields
}

func NewHMAC

func NewHMAC(key string) HMAC

func (*HMAC) Hash

func (h *HMAC) Hash(input string) string

type Response

type Response struct {
	ResponseCode int
	Context      *gin.Context
	Response     map[string]interface{}
}

func (*Response) SendAnswer

func (r *Response) SendAnswer()

SendAnswer transform the map into JSON and close the conexion of the Context

Jump to

Keyboard shortcuts

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