util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(pass, hashedpass string) error

func HashPassword

func HashPassword(password string) (string, error)

func InputSqlString

func InputSqlString(input string) (sql sql.NullString)

func RandomFileName

func RandomFileName(fileName string) (string, error)

func RandomType

func RandomType() string

func RandomUUID

func RandomUUID() string

func Randombyte

func Randombyte() []byte

func Randomemail

func Randomemail() string

func Randomint

func Randomint(min, max int64) int64

func Randomstring

func Randomstring(n int) string

func Randomuint

func Randomuint() []uint8

func Randomusername

func Randomusername() string

Types

type Config

type Config struct {
	DBDriver           string        `mapstructure:"DB_DRIVER"`
	DBSource           string        `mapstructure:"DB_SOURCE"`
	RedisSource        string        `mapstructure:"REDIS_ADDR"`
	Email              string        `mapstructure:"EMAIL_HOST"`
	EmailPass          string        `mapstructure:"EMAIL_PASSWORD"`
	BaseURL            string        `mapstructure:"BASE_URL"`
	BucketName         string        `mapstructure:"GCP_BUCKET_NAME"`
	SignUpLink         string        `mapstructure:"SIGNUPLINK"`
	HTTPServerAddress  string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	TokenKey           string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AuthErrorAddress   string        `mapstructure:"REDIRECT_AUTH_TOKEN"`
	BucketAccount      string        `mapstructure:"GC_BUCKET_PROFILE"`
	BucketPost         string        `mapstructure:"GC_BUCKET_POST"`
	ClientOption       string        `mapstructure:"GOOGLE_APPLICATION_CREDENTIALS"`
	GoogleClientID     string        `mapstructure:"GOOGLE_OAUTH_CLIENT_ID"`
	GoogleClientSecret string        `mapstructure:"GOOGLE_OAUTH_SECRET"`
	UserDir            string        `mapstructure:"USER_DIR"`
	EmailSMTP          string        `mapstructure:"EMAIL_SMTP"`
	MaxUploadSize      int64         `mapstructure:"MAX_UPLOAD_SIZE"`
	TokenDuration      time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshToken       time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
}

func LoadConfig

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

func (*Config) MaxUploadSizeInBytes

func (c *Config) MaxUploadSizeInBytes() int64

type Error

type Error struct {
	Code    int
	Message string
}

func NewError

func NewError(code int, message string) *Error

func (*Error) Error

func (e *Error) Error() (int, string)

type MultiError

type MultiError struct {
	Errors []error
}

func (*MultiError) Add

func (e *MultiError) Add(err error)

func (*MultiError) Error

func (e *MultiError) Error() string

func (*MultiError) Has

func (e *MultiError) Has(errors string) bool

func (*MultiError) HasError

func (e *MultiError) HasError() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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