util

package
v0.0.0-...-4e79b59 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password, hashedPassword string) error

CheckPassword check if a password is correct

func GetRandomCurrency

func GetRandomCurrency() string

GetRandomCurrency generate a random currency code

func GetRandomEmail

func GetRandomEmail() string

GetRandomEmail generate a random email

func GetRandomInt

func GetRandomInt() int64

GetRandomInt generate a random integer number

func GetRandomIntWithRange

func GetRandomIntWithRange(min, max int64) int64

GetRandomIntWithRange generate a random integer number with range [min, max)

func GetRandomMoneyAmount

func GetRandomMoneyAmount() int64

GetRandomMoneyAmount generate a random money amount with range [1, 1000)

func GetRandomOwnerName

func GetRandomOwnerName() string

GetRandomOwnerName generate a random owner name

func GetRandomStringWithLength

func GetRandomStringWithLength(length int) string

GetRandomStringWithLength generate a random string from alphabet with given length

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hash a password

Types

type Config

type Config struct {
	DBDriver          string        `mapstructure:"DB_DRIVER"`
	DBSource          string        `mapstructure:"DB_SOURCE"`
	ServerAddress     string        `mapstructure:"SERVER_ADDRESS"`
	TokenSymmetricKey string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessToken       time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
}

Config defines the configuration structure for the application

func LoadConfig

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

LoadConfig loads the configuration from file and environment variables

Jump to

Keyboard shortcuts

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