utils

package
v0.0.0-...-9abd94b Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultGenerator = func() string {
	id := uuid.NewV4()
	return id.String()
}

Functions

func AppFilePath

func AppFilePath(fpath string) string

func DBCon

func DBCon(config Config) (*gorm.DB, error)

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

func GenerateRandomString

func GenerateRandomString(s int) (string, error)

func PanicOnError

func PanicOnError(err error)

func RandomString

func RandomString(l int) string

Generate a random string of A-Z chars with len = l

Types

type Config

type Config struct {
	Host   string `json:"host"`
	Port   string `json:"port"`
	TestDB struct {
		Host     string `json:"host"`
		User     string `json:"user"`
		Password string `json:"password"`
		DbName   string `json:"dbname"`
	} `json:"test-db"`
	LiveDB struct {
		Host     string `json:"host"`
		User     string `json:"user"`
		Password string `json:"password"`
		DbName   string `json:"dbname"`
	} `json:"live-db"`
	Deployment string `json:"deployment"`
	S3host     string `json:"s3-host"`
}

func LoadConfig

func LoadConfig(filename string) (Config, error)

function for loading configuration file

type ConfigError

type ConfigError struct{}

func (*ConfigError) Error

func (*ConfigError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳