util

package
v0.0.0-...-9968e69 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

all supported currencies

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password, hashedPassword string) error

checks if the provided password is correct or not

func HashPassword

func HashPassword(password string) (string, error)

returns the bcrypt hash of a password

func IsSupported

func IsSupported(currency string) bool

func RandomCurrency

func RandomCurrency() string

generates a random currency

func RandomEmail

func RandomEmail() string

func RandomInt

func RandomInt(min, max int64) int64

generates random numbers between min and max

func RandomMoney

func RandomMoney() int64

generates a random amount of money

func RandomOwner

func RandomOwner() string

generates a random owner

func RandomString

func RandomString(n int) string

generates random string of n characters

Types

type Config

type Config struct {
	AppEnv               string        `mapstructure:"APP_ENV"`
	DBSource             string        `mapstructure:"DB_SOURCE"`
	MigrationURL         string        `mapstructure:"MIGRATION_URL"`
	RedisAddress         string        `mapstructure:"REDIS_ADDRESS"`
	HTTP_ServerAddress   string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	GRPC_ServerAddress   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"`
	EmailSenderPassword  string        `mapstructure:"EMAIL_SENDER_PASSWORD"`
	EmailSenderAddress   string        `mapstructure:"EMAIL_SENDER_Address"`
}

stores all configurations of the application. values are read by viper from the config file or environment variables

func LoadConfig

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

func (*Config) FetchDBSource

func (config *Config) FetchDBSource() string

Jump to

Keyboard shortcuts

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