package
0.2.42
Repository: https://github.com/polarbroadband/goto.git
Documentation: pkg.go.dev

# Functions

ApiGet pass JWT from original request to target api result will be saved to the given address.
AssertMapSliceString resolves a map[string][]string interface to []string.
AssertMapString resolves a map[string]string interface to string.
**************************************** string slice and map keys comparing functions **************************************** */ ConvToStrings converts a interface{} to []string underlying type []string or []interface{} only logging and return empty []string for any invalid input.
Debug pretty prints the any go object.
Decrypt decrypts data using 256-bit AES-GCM.
DiffHtmlInPretty is a modified DiffPrettyHtml function no html escape, original []Diff was generated from html block generate html code to be used within in <pre> optimized for dark background.
DiffTxtInPretty is a modified DiffPrettyHtml function apply html escape before convert generate html code to be used within in <pre> optimized for dark background.
DigValue walk through the embedded map[string]interface{} base on a sequence of keys retrieve the float64 value of last key will attemp to convert string i.e "1.43" to float64 if possible return nil and broken branch.
DigValue walk through the embedded map[string]interface{} base on a sequence of keys retrieve the string value of last key, return nil and broken branch.
DigValue walk through the embedded map[string]interface{} base on a sequence of keys retrieve the value of last key, return nil and broken branch.
Encrypt encrypts data using 256-bit AES-GCM.
EpochToString converts a int64 UTC epoch to a string.
FileExist check if the File exist and produced the same MD5 checksum.
GetCred prompt for entering username and password return empty strings if input not valid no screen echo for entering password.
GetEnvArrayFrFile getting an array of env var objects with "key" and "val" fields original sequence will be preserved.
GetEnvHashFrFile getting a k/v map of env var from a file in shell format.
**************************************** cli utility functions **************************************** */ GetInput display prompt and return trimed input string return empty string if input not valid.
GetStructDiff pretty jsonfy two structs and return the html diff result.
GetValueIgnoreCase get value of key regardless case return nil if not found.
HMSToDuration converts 6:10:30 format string to time.Duration.
IndexStrings returns index of element in given reference of string slice return -1 if not found.
InSlice check if a given value is in a slice use reflect DeepEqual as comparison method.
InStrings returns true if string in the slice of strings.
JoinKeys returns a string of map keys concatnated by a given string.
KeySlice returns a slice of map keys.
ListToIps converts a slice of IP address string to a IP obj slice.
LogWithFields attaches a slice of [k1,v1,k2,v2,...] to log entry.
MakeHtmlTable convert [][]string to html table (dark scene), auto scroll x.
MapMerge merge two map[string]interface{}.
NatureOrder creates a Compare instance operated on nature order of strings.
No description provided by the author
NewEncryptionKey generates a random 256-bit key for Encrypt() and Decrypt().
No description provided by the author
RandString generates random numeric and alphabetic string on a given length.
RemoveEmptyString remove the empty string from a slice.
RevStringsOrder revers the order of string slice.
RoundTo rounds a float to a given position, also a float type.
Sccno returns true if two string slices are equal, regardless order and repeat.
Sckm returns true if a string slice is equal to the keys of a map regardless the order or repeat elements in the slice.
SortMapByField sorts a list of map by the value of a given key either on the provided order or natural ascend string with numbers or int/int64 can be sorted in their natural order.
SortMapByTwoFields sorts a list of map by the value of two given keys either on the provided order or natural ascend string with numbers or int/int64 can be sorted in their natural order.
StringToDuration converts a duration string (8y10w7d6h5m20s)to time.Duration add year, week and day unit support on top of time.ParseDuration return 0 if invalid string.
StringToEpoch converts string to UTC epoch seconds.
StringToIP converts x.x.x.x/24 or f8ae:12::1/128 to IP obj, default mask is 32 or 128.
StringWithCharset generates random string on a given length and character set.
StrInterpolate interpolate and extand a symbol string to a string list the word to be calaulate mark as "^0-4$" to 0,1,2,3,4 the word to be calaulate mark as "^0-5+2$" to 0,2,4 the word to be calaulate mark as "^34, er_8, 9 8y$" to 34,er_8,9 8y "I had ^2 -3$ eggs for ^breakfast, dinner$" to be change to I had 2 eggs for breakfast I had 2 eggs for dinner I had 3 eggs for breakfast I had 3 eggs for dinner */.
TrimMap removes leading and tailing white spaces from all members.
TrmEmptyString trim white spaces of all members before remove the empty elements from a slice.
TrmStrings trim white spaces of all members but keep the empty elements.
Truncate a string to given length.
UpDown converts bool values to Up/Down string.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
http websocket upgrader.

# Structs

API supply REST/gRPC api common utilities.
No description provided by the author
IP holds IPv4 and IPv6 data structure and provides operations on it.
MongoOpr define methods for mongo database operation.
SessionMeta keeps authenticated JWT properties for the following websocket session.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WrappedServerStream is a grpc.ServerStream wrapper to expose context.

# Type aliases

AuthKey is a speical type used for keys in context values, to avoid accident override.
AuthToken is a PerRPCCredentials interface, as the augument of grpc.WithPerRPCCredentials().
Compare encapsulates a string comparison function.
function execution failure.