Documentation ¶
Index ¶
- Variables
- func ASCIITable(header []ASCIITableHeader, rows interface{}, escapePipes bool) (string, error)
- func CloneStringMap(src map[string]string) (clone map[string]string)
- func CopyFile(src, dst string) error
- func CopyFileMode(src, dst string) error
- func DurationString(dur time.Duration) string
- func ExpandDuration(val string) (res float64, err error)
- func FieldsFuncN(str string, fun func(rune) bool, maxV int) []string
- func FieldsN(s string, n int) []string
- func GetExecutablePath() (execDir, execFile, execPath string, err error)
- func GetSecureCiphers() (ciphers []uint16)
- func IsDigitsOnly(s string) bool
- func IsFile(path string) error
- func IsFloatVal(val interface{}) bool
- func IsFolder(path string) error
- func LineCounter(reader *os.File) int
- func List2String(list []string) (res string)
- func LogThreadDump(log *factorlog.FactorLog)
- func MimeType(fileName string) (mime string, err error)
- func ParseTLSMinVersion(version string) (uint16, error)
- func ParseVersion(str string) (num float64)
- func ReadPid(pidfile string) (int, error)
- func ReplaceCommonPasswordPattern(str string) string
- func Sha256FileSum(path string) (hash string, err error)
- func Sha256Sum(text string) (hash string, err error)
- func SortRanked(list []string, ranks map[string]int) []string
- func SortedKeys[V interface{}](m map[string]V) []string
- func TimeUnitF(num uint64, targetUnit string, precision int) float64
- func ToPrecision(val float64, precision int) float64
- func Tokenize(str string) []string
- func TokenizeBy(str, separator string, keepQuotes, keepSeparator bool) []string
- func TrimQuotes(str string) (res string, err error)
- type ASCIITableHeader
- type ByRank
- type WordRank
Constants ¶
This section is empty.
Variables ¶
var TimeFactors = []struct { suffix string factor float64 }{ {"ms", 0.001}, {"s", 1}, {"m", 60}, {"h", 3600}, {"d", 86400}, {"w", 86400 * 7}, {"y", 86400 * 365}, }
Functions ¶
func ASCIITable ¶
func ASCIITable(header []ASCIITableHeader, rows interface{}, escapePipes bool) (string, error)
ASCIITable creates an ascii table from columns and data rows
func CopyFileMode ¶
Copy file modes from src to destination
func DurationString ¶
func ExpandDuration ¶
ExpandDuration expand duration string into seconds
func FieldsFuncN ¶
FieldsFuncN is like strings.FieldsFunc, but returns at most n fields, and the nth field includes any runes at the end of the string normally excluded by f.
func FieldsN ¶
FieldsN is like strings.Fields, but returns at most n fields, and the nth field includes any whitespace at the end of the string.
func GetExecutablePath ¶
GetExecutablePath returns path to executable information execDir: folder of the executable execFile: file name (basename) of executable execPath: full path to executable (dir/file)
func GetSecureCiphers ¶
func GetSecureCiphers() (ciphers []uint16)
func IsDigitsOnly ¶
IsDigitsOnly returns true if string only contains numbers
func IsFloatVal ¶
func IsFloatVal(val interface{}) bool
IsFloatVal returns true if given val is a real float64 with fractions or false if value can be represented as int64
func List2String ¶
List2String converts a list of strings into a single quoted comma separated list: 'a', 'b', 'c'...
func LogThreadDump ¶
func ParseTLSMinVersion ¶
func ParseVersion ¶
func Sha256FileSum ¶
Sha256FileSum returns sha256 sum for given file
func SortedKeys ¶
returns string map keys in sorted order
func ToPrecision ¶
ToPrecision converts float64 to given precision, ex.: 5.12345 -> 5.1
func Tokenize ¶
Tokenize returns list of string tokens token will still have quotes around after tokenizing
func TokenizeBy ¶
TokenizeBy returns list of string tokens separated by any char in separator