util

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoalesceErr

func CoalesceErr(errs ...error) error

CoalesceErr takes a variable numbers of errors and returns an error

func EnvIsTrue added in v0.0.38

func EnvIsTrue(key string) bool

func GenerateRandAlphaNumericKey

func GenerateRandAlphaNumericKey(n int) (string, error)

Generate a random alphanumeric string

func GenerateRandCode

func GenerateRandCode(n int) string

Generate a random integer code of length n

func GenerateRandDBName

func GenerateRandDBName() (string, error)

func GenerateRandEmail

func GenerateRandEmail() string

func GenerateRandPassword

func GenerateRandPassword() (string, error)

func GenerateRandPhoneNumber

func GenerateRandPhoneNumber() string

func GetAbsolutePath

func GetAbsolutePath(filePath string) string

func GetEnv

func GetEnv(key, defaultValue string) string

func GetPathToScript

func GetPathToScript(path string, fromTest bool) string

path should be scripts/... e.g. scripts/custom_graphql.ts

func GoSchemaKill

func GoSchemaKill(v interface{})

panic not ok in typescript path. ok in golang since that's deprecated and not updated using a different API to make it easier to grep/etc

func StringsEqual

func StringsEqual(slice, slice2 []string) bool

func WrapBlack added in v0.1.6

func WrapBlack(text string) string

func WrapBlue added in v0.1.6

func WrapBlue(text string) string

func WrapBrightGreen added in v0.1.6

func WrapBrightGreen(text string) string

func WrapBrightRed added in v0.1.6

func WrapBrightRed(text string) string

func WrapCyan added in v0.1.6

func WrapCyan(text string) string

func WrapGreen added in v0.1.6

func WrapGreen(text string) string

func WrapMagenta added in v0.1.6

func WrapMagenta(text string) string

func WrapRed added in v0.1.6

func WrapRed(text string) string

func WrapWhite added in v0.1.6

func WrapWhite(text string) string

func WrapYellow added in v0.1.6

func WrapYellow(text string) string

Types

type Color added in v0.1.6

type Color string
const (
	// colors from https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
	Black   Color = "\033[030m"
	Red     Color = "\033[31m"
	Green   Color = "\033[32m"
	Yellow  Color = "\033[33m"
	Blue    Color = "\033[34m"
	Magenta Color = "\033[35m"
	Cyan    Color = "\033[36m"
	White   Color = "\033[37m"
	Reset   Color = "\033[0m"

	BrightBlack   Color = "\033[30;1m"
	BrightRed     Color = "\033[31;1m"
	BrightGreen   Color = "\033[32;1m"
	BrightYellow  Color = "\033[33;1m"
	BrightBlue    Color = "\033[34;1m"
	BrightMagenta Color = "\033[35;1m"
	BrightCyan    Color = "\033[36;1m"
	BrightWhite   Color = "\033[37;1m"
)

type ErrorList

type ErrorList struct {
	// contains filtered or unexported fields
}

ErrorList encompasses a list of errors. It's also an error

func (*ErrorList) Error

func (e *ErrorList) Error() string

Jump to

Keyboard shortcuts

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