utils

package
Version: v0.0.0-...-caf6f44 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanicLevel LogLevel = "panic"
	FatalLevel          = "fatal"
	ErrorLevel          = "error"
	WarnLevel           = "warn"
	InfoLevel           = "info"
	DebugLevel          = "debug"
	TraceLevel          = "trace"

	TerminalFormat LogFormatter = "terminal"
	JSONFormat                  = "json"
	TextFormat                  = "text"
)
View Source
const (
	ScryptHashID = "s1"
)

Variables

This section is empty.

Functions

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString returns a random string of the given length. It uses 0-9, a-z and A-Z characters. You should not use this for IDs, as random strings are not sortable.

func GetCurrentTime

func GetCurrentTime() time.Time

func GetPathSegments

func GetPathSegments(path string) []string

func GetTimeIn

func GetTimeIn(duration time.Duration) time.Time

func HashScrypt

func HashScrypt(plaintext string) (hash string, err error)

func JoinPaths

func JoinPaths(paths ...string) string

func SplitPath

func SplitPath(path string) (string, string)

func ValidateScryptPassword

func ValidateScryptPassword(plaintext, hashed string) (err error)

Types

type LogFormatter

type LogFormatter string

type LogLevel

type LogLevel string

type Logger

type Logger interface {
	logrus.FieldLogger
}

func CreateLogger

func CreateLogger(config *LoggingConfig) Logger

type LoggingConfig

type LoggingConfig struct {
	Level        LogLevel
	Formatter    LogFormatter
	ReportCaller bool
}

Jump to

Keyboard shortcuts

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