util

package
v0.0.0-...-8f6dbd5 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func HashPasswordBcrypt

func HashPasswordBcrypt(password string) (string, error)

HashPasswordBcrypt hashes a password using bcrypt, and returns it as a string

func HashPasswordBlake

func HashPasswordBlake(password string) string

HashPassword hashes a password using blake2b, encodes it to hex, and returns it as a string

func IsSupportedCurrency

func IsSupportedCurrency(currency string) bool

IsSupportedCurrency returns true if given currency is supported

func RandomCurrency

func RandomCurrency() string

func RandomEmail

func RandomEmail() string

func RandomFullname

func RandomFullname() string

func RandomInt

func RandomInt(min, max int64) int64

func RandomMoneyAmount

func RandomMoneyAmount() int64

func RandomOwner

func RandomOwner() string

func RandomPassword

func RandomPassword() string

func RandomString

func RandomString(length int) string

func VerifyPasswordBcrypt

func VerifyPasswordBcrypt(password string, hashedpassword string) error

VerifyPasswordBcrypt verifies a password using bcrypt.

func VerifyPasswordBlake

func VerifyPasswordBlake(password string, hashedpassword string) bool

VerifyPasswordBlake verifies a password using blake2b. Returns true if the password matches the hash

Types

type Config

type Config struct {
	Environment         string        `mapstructure:"ENVIRONMENT"`
	DB_Source           string        `mapstructure:"DB_SOURCE"`
	Migration_Url       string        `mapstructure:"MIGRATION_URL"`
	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"`
}

func LoadConfig

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

TODO check env to differantiate between env to apply different configs for dev, test, prod

Jump to

Keyboard shortcuts

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