utils

package
v0.0.0-...-e758d5e Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USD = "USD"
	EUR = "EUR"
	GBP = "GBP"
	NGN = "NGN"
	AUD = "AUD"
	CAD = "CAD"
	CDF = "CDF"
)

Variables

This section is empty.

Functions

func IsSupportedCurrency

func IsSupportedCurrency(currency string) bool

func RandomCurrencyCode

func RandomCurrencyCode() string

RandomCurrencyCode returns a random currency code

func RandomEmail

func RandomEmail() string

RandomUser returns a random email address

func RandomInt

func RandomInt(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomMoney

func RandomMoney() int64

RandomMoney returns a random money amount

func RandomOwner

func RandomOwner() string

RandomOwner returns a random owner name

func RandomString

func RandomString(n int) string

RandomString generate a random string of length n characters

Types

type Config

type Config struct {
	DBDriver             string        `mapstructure:"DB_DRIVER"`
	DBSource             string        `mapstructure:"DB_SOURCE"`
	VBankAddr            string        `mapstructure:"VBANK_ADDR"`
	RedisAddress         string        `mapstructure:"REDIS_ADDRESS"`
	HTTPServerAddress    string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	GRPCServerAddress    string        `mapstructure:"GRPC_SERVER_ADDRESS"`
	TokenSymmetricKey    string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	EmailSenderName      string        `mapstructure:"EMAIL_SENDER_NAME"`
	EmailSenderAddress   string        `mapstructure:"EMAIL_SENDER_ADDRESS"`
	EmailSenderPassword  string        `mapstructure:"EMAIL_SENDER_PASSWORD"`
}

func LoadConfig

func LoadConfig(path, filename, envType string) *Config

type Hasher

type Hasher struct {
	Cost int
}

func NewHasher

func NewHasher(cost int) Hasher

func (Hasher) CheckPassword

func (h Hasher) CheckPassword(password, hashedPassword string) error

func (Hasher) HashPassword

func (h Hasher) HashPassword(password string) (string, error)

Jump to

Keyboard shortcuts

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