utils

package
v0.0.0-...-be1fadd Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Currencies = map[string]string{
	"USD": "USD",
	"IDR": "IDR",
}

Functions

func GenerateHashPassword

func GenerateHashPassword(password string) (string, error)

func GetActiveUser

func GetActiveUser(c *gin.Context) (int64, error)

func IsValidCurrency

func IsValidCurrency(currency string) bool

func RandomEmail

func RandomEmail() string

func RandomString

func RandomString(r int) string

func VerifyPassword

func VerifyPassword(password, hashedPassword string) error

Types

type Config

type Config struct {
	DBDriver     string `mapstructure:"DB_DRIVER"`
	DBSource     string `mapstructure:"DB_SOURCE"`
	DBSourceLive string `mapstructure:"DB_SOURCE_LIVE"`
	SigningKey   string `mapstructure:"SIGNING_KEY"`
}

func LoadConfig

func LoadConfig(path string) (config *Config, err error)

type JWTToken

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

func NewJWTToken

func NewJWTToken(config *Config) *JWTToken

func (*JWTToken) CreateToken

func (j *JWTToken) CreateToken(userID int64) (string, error)

func (*JWTToken) VerifyToken

func (j *JWTToken) VerifyToken(tokenString string) (int64, error)

Jump to

Keyboard shortcuts

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