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(msg string) (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(str string) (string, error)
- func Decrypt(text string, key string) ([]byte, error)
- func DecryptLocal(ciphertext string, key string) ([]byte, error)
- func DeepCopyJson(data map[string]interface{}) (map[string]interface{}, error)
- func Encrypt(text string, key string) (string, error)
- func EncryptLocal(text []byte, key string) (string, error)
- func EscapeHTML(html []byte) []byte
- func EscapeHTMLArgs(html []byte) []byte
- func FormatMemoryUsage(b uint64) float64
- func GetFileFromParent(root string, start string, search string) (string, bool)
- func GetLinuxInstaller(man []string) string
- func HasLinuxPkg(pkg []string) bool
- func IndexOf[T any](search []T, value T) (int, error)
- func IndexOfMap[T Hashable, J any](search map[T]J, value J) (T, error)
- func InstallLinuxPkg(pkg []string, man ...string)
- func IsZeroOfUnderlyingType(x interface{}) bool
- func JoinPath(path ...string) (string, error)
- func ParseJson(b []byte) (map[string]interface{}, error)
- func StringifyJSON(data interface{}, ind ...int) ([]byte, error)
- func ToByteArray(res interface{}) []byte
- func ToInt(res interface{}) int
- func ToString(res interface{}) string
- func TrimRepeats(b []byte, chars []byte) []byte
- 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{}
CleanArray runs CleanStr on an []interface{} CleanStr: Sanitizes a string to valid UTF-8
func CleanJSON ¶
func CleanJSON(val interface{}) interface{}
CleanJSON runs CleanStr on a complex json object recursively CleanStr: Sanitizes a string to valid UTF-8
func CleanMap ¶
CleanMap runs CleanStr on a map[string]interface{} CleanStr: Sanitizes a string to valid UTF-8
func ContainsMap ¶
ContainsMap returns true if a map contains a value
func ContainsMapKey ¶
ContainsMapKey returns true if a map contains a key
func DecodeJSON ¶
DecodeJSON is useful for decoding a JSON output from the body of an http request example: goutil.DecodeJSON(r.Body)
func Decompress ¶
Decompress is Gzip decompression for a string
func DecryptLocal ¶ added in v2.0.1
DecryptLocal is a Non Standard AES-CFB Decryption method Purposely incompatible with other libraries and programing languages This was made by accident, and this bug is now a feature Notice: This Feature Is Experimental
func DeepCopyJson ¶
DeepCopyJson will stringify and parse json to create a deep copy and escape pointers
func EncryptLocal ¶ added in v2.0.1
EncryptLocal is a Non Standard AES-CFB Encryption method Purposely incompatible with other libraries and programing languages This was made by accident, and this bug is now a feature Notice: This Feature Is Experimental
func EscapeHTML ¶
EscapeHTML replaces HTML characters with html entities Also prevents & from results
func EscapeHTMLArgs ¶
EscapeHTMLArgs escapes quotes and backslashes for use within HTML quotes
func FormatMemoryUsage ¶
FormatMemoryUsage converts bytes to megabytes
func GetFileFromParent ¶
GetFileFromParent 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 ¶
GetLinuxInstaller attempt to find out what package manager a linux distro is using or has available
func HasLinuxPkg ¶
HasLinuxPkg attempt to check if a linux package is installed
func IndexOf ¶ added in v2.0.1
IndexOf returns the index of a value in an array returns -1 and an error if the value is not found
func IndexOfMap ¶ added in v2.0.1
IndexOfMap returns the index of a value in a map returns an error if the value is not found
func InstallLinuxPkg ¶
InstallLinuxPkg attempts 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
IsZeroOfUnderlyingType can be used to determine if an interface{} in null or empty
func StringifyJSON ¶
StringifyJSON converts a map or array to a JSON string
func ToByteArray ¶
func ToByteArray(res interface{}) []byte
ToByteArray converts multiple types to a []byte accepts: string, []byte, byte, int32, int, int64, float64, float32
func ToInt ¶
func ToInt(res interface{}) int
ToInt converts multiple types to an int accepts: int, int32, int64, float64, float32, string, []byte, byte
func ToString ¶
func ToString(res interface{}) string
ToString converts multiple types to a string accepts: string, []byte, byte, int32, int, int64, float64, float32
func TrimRepeats ¶ added in v2.0.2
TrimRepeats trims repeating adjacent characters and reduces them to one character b: byte array to trim chars: list of bytes to trim repeats of