utils

package
v0.0.0-...-1291c50 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorInternalError :
	ErrorInternalError = errors.New("whoops something went wrong")
	// ErrorPasswordMismatch :
	ErrorPasswordMismatch = errors.New("Password don't match")
	// ErrorNotYetImplemented :
	ErrorNotYetImplemented = errors.New("Not yet implemented")
	// ErrorPlayerAlreadyExist :
	ErrorPlayerAlreadyExist = errors.New("Player already exist")
	// ErrorPlayerCreationFailed :
	ErrorPlayerCreationFailed = errors.New("Unable to create new player")
	// ErrorDatabaseOperationFailed :
	ErrorDatabaseOperationFailed = errors.New("Database operation failed")
	// ErrorPlayerNotFound :
	ErrorPlayerNotFound = errors.New("Player not found")
	// ErrorEncryptionFailed :
	ErrorEncryptionFailed = errors.New("Encryption failed")
	// ErrorInvalidQuery :
	ErrorInvalidQuery = errors.New("Invalid query parameter")
	// ErrorRequestIDMismatch :
	ErrorRequestIDMismatch = errors.New("Request ID do not match")
	// ErrorPlayerUpdateFailed :
	ErrorPlayerUpdateFailed = errors.New("Unable to update player")
	// ErrorPlayerDeleteFailed :
	ErrorPlayerDeleteFailed = errors.New("Unable to delete player")
	// ErrorAuthenticationFailed :
	ErrorAuthenticationFailed = errors.New("Username or Password not valid")
	// ErrorAuthorizationTokenNotFound :
	ErrorAuthorizationTokenNotFound = errors.New("Player authorization not found")
	// ErrorAuthorizationVerificationFailed :
	ErrorAuthorizationVerificationFailed = errors.New("Authorization failed")
)
View Source
var (
	// ReasonInternalServer :
	ReasonInternalServer = "InternalServerError"
	// ReasonPasswordMismatch :
	ReasonPasswordMismatch = "PasswordMismatch"
	// ReasonEntityCreationFailed :
	ReasonEntityCreationFailed = "EntityCreationFailed"
	// ReasonFieldValidationError :
	ReasonFieldValidationError = "FieldValidationError"
	// ReasonEntityNotFound :
	ReasonEntityNotFound = "EntityNotFound"
	// ReasonIDMismatch :
	ReasonIDMismatch = "IDMismatch"
	// ReasonEntityDeletionFailed :
	ReasonEntityDeletionFailed = "EntityDeletionFailed"
	// ReasonAuthorizationFailed :
	ReasonAuthorizationFailed = "AuthorizationFailed"
)

Functions

func CompareHashWithPassword

func CompareHashWithPassword(password string, hash string) (match bool, err error)

CompareHashWithPassword :

func CompareStrings

func CompareStrings(first string, second string, err error) (bool, error)

CompareStrings :

func GenerateHashFromPassword

func GenerateHashFromPassword(password string) (hash string, err error)

GenerateHashFromPassword :

func GenerateToken

func GenerateToken(c *gin.Context, player *models.Player) *models.Token

GenerateToken :

func HasTokenExpired

func HasTokenExpired(token string) bool

HasTokenExpired :

func ParseQueryToInt

func ParseQueryToInt(queries ...string) ([]int, *models.ErrorParsing)

ParseQueryToInt ;

func VerifyToken

func VerifyToken(token string) error

VerifyToken :

Types

This section is empty.

Jump to

Keyboard shortcuts

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