util

package
v0.0.0-...-e3d9045 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

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

Constantes para todo tipo de monedas

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password string, hashedPassword string) error

CheckPassword verifica si la contraseña porporcionada es correcta o no

func HashPassword

func HashPassword(password string) (string, error)

HashPassword devuelve el hash bcrypt de la contraseña

func IsSupportedCurrency

func IsSupportedCurrency(currency string) bool

IsSupportedCurrency devuelve true si la moneda es soportada

func RandomCurrency

func RandomCurrency() string

RandomCurrency genera un código de cambio de divisas aleatorio.

func RandomEmail

func RandomEmail() string

func RandomInt

func RandomInt(min, max int64) int64

RandomInt genera un entero aleatorio entre el mínimo y el máximo

func RandomMoney

func RandomMoney() int64

RandomMoney genera un monto de dinero aleatorio

func RandomOwner

func RandomOwner() string

RandomOwner genera un nombre propierario aleatorio

func RandomString

func RandomString(n int) string

RandomString genera una cadena alatoria de la longitud n

Types

type Config

type Config struct {
	DBDriver            string        `mapstructure:"DB_DRIVER"`
	DBSource            string        `mapstructure:"DB_SOURCE"`
	ServerAddress       string        `mapstructure:"SERVER_ADDRESS"`
	TokenSymetricKey    string        `mapstructure:"TOKEN_SYMETRIC_KEY"`
	AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
}

Config almacena toda la configuración de la aplicación. Los valores son leídos por viper desde el archivo de configuración o variables de entorno.

func LoadConfig

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

LoadConfig lee la configuración desde el archivo o variables de entorno.

Jump to

Keyboard shortcuts

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