Documentation ¶
Index ¶
- Variables
- func CleanArray(data []interface{}) []interface{}
- func CleanByte(b []byte) []byte
- func CleanJSON(val interface{}) interface{}
- func CleanMap(data map[string]interface{}) map[string]interface{}
- func CleanStr(str string) string
- func Compress[T interface{ ... }](msg T) (string, error)
- func Contains[T any](search []T, value T) bool
- func ContainsMap[T Hashable, J any](search map[T]J, value J) bool
- func ContainsMapKey[T Hashable, J any](search map[T]J, key T) bool
- func DecodeJSON(data io.Reader) (map[string]interface{}, error)
- func Decompress[T interface{ ... }](str T) (string, error)
- func Decrypt[T interface{ ... }, J interface{ ... }](text T, key J) ([]byte, error)
- func Encrypt[T interface{ ... }, J interface{ ... }](text T, key J) (string, error)
- func EscapeHTML[T interface{ ... }](html T) T
- func EscapeHTMLArgs[T interface{ ... }](html T) T
- func FormatMemoryUsage(b uint64) float64
- func GetFileFromParent[T interface{ ... }](root T, start T, search string) (string, bool)
- func GetLinuxInstaller(man []string) string
- func HasLinuxPkg(pkg []string) bool
- func InstallLinuxPkg(pkg []string, man ...string)
- func IsZeroOfUnderlyingType(x interface{}) bool
- func JoinPath[T interface{ ... }](path ...T) (string, error)
- func ParseJson[T interface{ ... }](b T) (map[string]interface{}, error)
- func StringifyJSON(data interface{}, ind ...int) ([]byte, error)
- func ToInt(res interface{}) int
- func ToString(res interface{}) string
- func WatchDir(root string, cb *Watcher)
- type Hashable
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var VarType map[string]reflect.Type
Functions ¶
func CleanArray ¶
func CleanArray(data []interface{}) []interface{}
Runs CleanStr on an array CleanStr: Sanitizes a string to valid UTF-8
func CleanJSON ¶
func CleanJSON(val interface{}) interface{}
Runs CleanStr on a complex json object recursively CleanStr: Sanitizes a string to valid UTF-8
func ContainsMap ¶
Returns true if a map contains a value
func ContainsMapKey ¶
Returns true if a map contains a key
func DecodeJSON ¶
Useful for decoding a JSON output from the body of an http request goutil.DecodeJSON(r.Body)
func Decompress ¶
Gzip decompression for a string
func Decrypt ¶
func Decrypt[T interface{ string | []byte }, J interface{ string | []byte }](text T, key J) ([]byte, error)
AES-CFB Decryption
func Encrypt ¶
func Encrypt[T interface{ string | []byte }, J interface{ string | []byte }](text T, key J) (string, error)
AES-CFB Encryption
func EscapeHTML ¶
Replaces HTML characters with html entities Also prevents & from results
func EscapeHTMLArgs ¶
Escapes quotes and backslashes for use within HTML quotes
func GetFileFromParent ¶
func GetFileFromParent[T interface{ string | []byte }](root T, start T, search string) (string, bool)
Checks if the parent (or sub parent) directory of a file contains a specific file or folder root: the highest grandparent to check before quitting start: the lowest level to start searching from (if a directory is passed, it will not be included in your search) search: what file you want to search fro
func GetLinuxInstaller ¶ added in v1.0.3
Attempt to find out what package manager a linux distro is using or has available
func HasLinuxPkg ¶ added in v1.0.3
Attempt to check if a linux package is installed
func InstallLinuxPkg ¶ added in v1.0.3
Attempt to install a linux package this method will also resolve the sudo command and ask for a user password if needed this method will not attempt to run an install, if it finds the package is already installed
func IsZeroOfUnderlyingType ¶
func IsZeroOfUnderlyingType(x interface{}) bool
func StringifyJSON ¶
Converts a map or array to a JSON string
func ToInt ¶
func ToInt(res interface{}) int
Converts multiple types to an int accepts: int, int32, int64, float64, float32, string, byteArray, byte