Categorygithub.com/eaglebush/stdutil
modulepackage
0.0.0-20241113060340-8021574672b6
Repository: https://github.com/eaglebush/stdutil.git
Documentation: pkg.go.dev

# README

stdutil

Standard utilities for NarsilWorks

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Functions

AnyToString converts any variable to string.
BuildEvent builds an event based on the inputs.
BuildSeries builds series based on options.
Compressed sets the request compression as an option This is used with <REST verb>Api functions.
CreateApi posts data on an API endpoint and converts the returned data into a resulting type.
DecodeCommand decodes an encrypted and base64-encoded text for the receiving page # It uses the library key to decrypt the string after the input has been decoded from base64 Deprecated: Use the EncodeText and DecodeText functions with a 32-bit application-defined key.
DecodeText decodes an encypted base64-encoded text with a key and returns a decrypted string.
Decrypt - decrypt a string using AES.
DeleteApi deletes data on an API endpoint and converts the returned data into a resulting type.
DeleteJson wraps http.Delete and gets a raw json message data.
Elem returns the element of an array as specified by the index If the index exceeds the length of an array, it will return a non-nil value of the type.
ElemPtr returns a pointer to the element of an array as specified by the index If the index exceeds the length of an array, it will return a non-nil value of the type.
EncodeCommand encodes a command to be decoded by the receiving page # It uses the library key to encrypt the string and later encoded with base64 Deprecated: Use the EncodeText and DecodeText functions with a 32-bit application-defined key.
EncodeText encodes plain text with a key and returns an encrypted and base64-encoded string.
Encrypt - encrypt a string using AES.
ExecuteApi wraps http operation that change or read data and returns a byte array On headers: - Content-Type: If this header is not set, it defaults to "application/json"// - Content-Encoding: If compressed is true, it is set to "gzip".
ExecuteJsonApi wraps http operation that change or read data and returns a custom result.
GenerateAlpha generates a random text that uses the 26 letters of the alphabet.
GenerateFull generates a random text that uses all letters of the alphabet, in both cases including numbers.
GenerateSeries generates random numbers.
GenerateText generates a random text that uses all letters of the alphabet, in both cases not including numbers.
GetEventModuleMatch seeks the list of events by module.
GetEventSubjectMatch seeks the list of event by subject.
GetJson wraps http.Get and gets a raw json message data.
GetRequestVars requests variables and return JWT validation result.
GetRequestVarsOnly get request variables.
GetZero gets the zero value of the type.
Headers adds request headers as an option This is used with <REST verb>Api functions.
If is a basic ternary operator to return whatever is set in truthy and falsey parameter.
In checks if the seek parameter is in the list parameter Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
InitResult - initialize result for API query.
Interpolate interpolates string with the name value pairs.
IsNullOrEmpty checks for emptiness of a pointer variable ignoring nullity Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
IsNullOrEmpty checks for nullity and emptiness of a pointer variable Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
IsNumeric checks if a string is numeric.
MapVal retrieves a value from a map by a key and converts it to the type indicated by T.
NameValueGet gets the value from the collection of NameValues by name This function requires version 1.18+.
NameValueGetPtr gets the value from the collection of NameValues by name as pointer This function requires version 1.18+.
NameValuesToInterfaceArray converts name values to interface array.
New initializes a variable and returns a pointer of its type Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
NewEventSubjectBase properly creates a new event base.
NonNullComp compares two parameters when both are not nil.
Null accepts a value to test and the default value if it fails.
NullPtr accepts a value to test and the default value if it fails.
ParseDate parses a string as date.
ParseJwt validates, parses JWT and returns information using HMAC256 algorithm.
ParseQueryString parses the query string into a column value.
ParseRouteVars parses custom routes from a mux handler.
PatchApi patches data on an API endpoint and converts the returned data into a resulting type.
PatchJson wraps http.Patch and gets a raw json message data.
PostJson wraps http.Post and gets a raw json message data.
PutJson wraps http.Put and gets a raw json message data.
ReadApi retrieves data on an API endpoint and converts the returned data into a resulting type.
SafeMapRead allows reading maps by locking it, preventing the library from crashing Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
SafeMapWrite allows writing to maps by locking, preventing the library from crashing Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
Seek checks if the seek parameter is in the list parameter and returns it.
SetRequestTimeOut sets the new timeout value.
SignJwt builds a JWT token using HMAC256 algorithm.
SortByKey reorders keys and values based on a keyOrder array sequence.
StringToByte converts string or strings to byte array with an option for a separator.
StripEndingForwardSlash removes the ending forward slash of a string.
StripLeading strips string of leading characters by an offset.
StripTrailing strips string of trailing characters after the length.
TimeOut sets the request timeout as an option This is used with <REST verb>Api functions.
ToInterfaceArray converts a value to interface array Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
UpdateApi updates data on an API endpoint and converts the returned data into a resulting type.
Val gets the value of a pointer in order Currently supported data types are: - constraints.Ordered (Integer | Float | ~string) - time.Time - bool - shopspring/decimal This function requires version 1.18+.
ValidateDecimal validates a decimal input against decimal validation options.
ValidateEmail validates an e-mail address.
ValidateJwt validates JWT and returns information using HMAC256 algorithm.
ValidateNumeric validates a numeric input against numeric validation options Currently supported data types are: - constraints.Integer (Signed | Unsigned) - constraints.Float (~float32 | ~float64) This function requires version 1.18+.
ValidateString validates an input string against the string validation options.
ValidateTime validates an input time against the time validation options.

# Constants

No description provided by the author
Status items.
search for ${*}.
Status items.
Status items.
Status items.
No description provided by the author
No description provided by the author
Status items.
Status items.

# Variables

Errors.

# Structs

No description provided by the author
CustomVars - command struct.
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
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Result - standard result structure.
ResultAny struct with generic type data.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
Status type.