util

package
v0.0.0-...-1275880 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USD = "USD"
	EUR = "EUR"
	CAD = "CAD"
	INR = "INR"
)

Variables

View Source
var (
	ErrExpiredToken = errors.New("token has expired")
	ErrInvalidToken = errors.New("token is invalid")
)

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

CheckPassword checks if the password is correct

func HashedPassword

func HashedPassword(password string) (string, error)

HashedPassword return the bcrypt hash of the password

func IsSupportCurrency

func IsSupportCurrency(currency string) bool

IsSupportCurrency checks if currency is supported

func RandomCurrency

func RandomCurrency() string

RandomCurrency generates a random currency code

func RandomEmail

func RandomEmail() string

RandomEmail generates a random email

func RandomHashedPassword

func RandomHashedPassword() string

RandomHashedPassword generates a random hashed password

func RandomInt

func RandomInt(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomMoney

func RandomMoney() int64

RandomMoney generates a random amount of money

func RandomOwner

func RandomOwner() string

RandomOwner generates a random owner name

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n

Types

type Config

type Config struct {
	DBDriverPostgres string `mapstructure:"DB_DRIVER_POSTGRES"`
	DBSourcePostgres string `mapstructure:"DB_SOURCE_POSTGRES"`
	ServerAddress    string `mapstructure:"SERVER_ADDRESS"`
}

Config is the configuration for the application

func LoadConfig

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

LoadConfig loads config from file

Jump to

Keyboard shortcuts

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