utils

package
v0.0.0-...-741e748 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w http.ResponseWriter, statusCode int, data interface{})

JSON returns a well formated response with a status code

func MigrateDown

func MigrateDown(config Config, path string) error

func MigrateSteps

func MigrateSteps(steps int, config Config, path string) error

func MigrateUp

func MigrateUp(config Config, path string) error

func RandomInt

func RandomInt(min, max int64) int64

RandomInt Generates a random number between min and max

func RandomString

func RandomString(n int) string

RandomString Generates a Random String of N characters

func StrToBinary

func StrToBinary(s string, base int) []byte

Types

type Config

type Config struct {
	DBUri       string `mapstructure:"DB_URI" env:"DB_URI"`
	SecretKey   string `mapstructure:"SECRET_KEY" env:"SECRET_KEY"`
	RedisPass   string `mapstructure:"REDIS_PASS" env:"REDIS_PASS"`
	RedisHost   string `mapstructure:"REDIS_HOST" env:"REDIS_HOST"`
	RedisDb     int    `mapstructure:"REDIS_DB"   env:"REDIS_DB"`
	MaxFileSize int64  `mapstructure:"MAX_FILE_SIZE" env:"MAX_FILE_SIZE"`
}

Config stores all configuration of the application

func LoadConfig

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

Jump to

Keyboard shortcuts

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