util

package
v0.0.0-...-c7a98c3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const START_FAILED = 1

Variables

This section is empty.

Functions

func CheckError

func CheckError(text string, err error)

CheckError prints the msg with the prefix and exits with error code 1. If the msg is nil, it does nothing.

func HashPassword

func HashPassword(password string) (string, error)

HashPassword returns the bcrypt hash of the password.

func RandEmail

func RandEmail() string

func RandIP

func RandIP() string

func RandInternalString

func RandInternalString(min, max int) string

func RandString

func RandString(n int) string

func VerifyPassword

func VerifyPassword(password string, hashedPassword string) error

VerifyPassword checks the password is correct or not

Types

type Setting

type Setting struct {
	LogFile              string        `mapstructure:"log_file"`
	LogLevel             string        `mapstructure:"log_level"`
	DriverName           string        `mapstructure:"driver_name"`
	DatabaseDriverString string        `mapstructure:"database_driver_string"`
	MigrationDirectory   string        `mapstructure:"migration_directory"`
	GinServerAddress     string        `mapstructure:"gin_server_address"`
	GRPCServerAddress    string        `mapstructure:"grpc_server_address"`
	GRPCGatewayAddress   string        `mapstructure:"grpc_gateway_address"`
	TokenType            string        `mapstructure:"token_type"`
	TokenDuration        time.Duration `mapstructure:"token_duration"`
	RefreshTokenDuration time.Duration `mapstructure:"refresh_token_duration"`
}

func GetSetting

func GetSetting() *Setting

Jump to

Keyboard shortcuts

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