Categorygithub.com/itdesign-at/golib/converter
modulepackage
1.0.3
Repository: https://github.com/itdesign-at/golib.git
Documentation: pkg.go.dev

# README

package converter

FunctionComment
func Denormalize(in string) stringDenormalize does the opposite of Normalize
func Normalize(in string) stringNormalize a string by removing all special characters
func GetRandomString(length int) stringreturns a random string with length given
func GetMobileNumber(input string) (string, error)extract the mobile number without blanks
func PrepareMobileNumber(input interface{}) (string, error)PrepareMobileNumber returns 0043664....
func Fnv1aHash(input string) stringreturns a 32 bit FNV-1a hash
func B64Dec(b64s string) (string, error)decode string in base64 format
func B64MustDec(b64s string) stringdecode string in base64 format, panics on error
func B64Enc(s string) stringencode string to base64 format
func Dec(format string, src string, dst interface{}) errordecode string in specific format
func Enc(format string, src interface{}) (string, error)encode string to specific format
func MustDec(format string, src string, dst interface{})decode string to specific format, panics on error
func MustEnc(format string, src interface{}) stringencode string to specific format, panics on error
func JsonDec(src string, dst interface{}) errordecode json in specific format
func JsonEnc(src interface{}) (string, error)encode json to specific format
func JsonMustDec(src string, dst interface{})decode json to specific format, panics on error
func JsonMustEnc(src interface{}) stringencode json to specific format, panics on error

# Functions

B64Dec decodes string in base64 format.
B64Enc encodes string to base64 format.
B64MustDec useit as B64dec but panics on error.
Dec decodes string in specific format supported format strings are: base64: "b64", "base64" json: "json", "application/json", "application/x-json", "text/json", "text/x-json" yaml: "application/yaml", "application/x-yaml", "text/yaml", "text/x-yaml".
Denormalize does the opposite of Normalize and converts Q<hex> strings back to readable.
Enc encodes string to specific format supported format strings are: base64: "b64", "base64" json: "json", "application/json", "application/x-json", "text/json", "text/x-json" yaml: "application/yaml", "application/x-yaml", "text/yaml", "text/x-yaml".
Fnv1aHash returns a 32 bit FNV-1a hash Usage example: hash := converter.Fnv1aHash("Vienna") fmt.Println(hash) // prints "712dc882".
GetMobileNumber extracts the mobile number without blanks.
GetRandomString returns a random string with length given.
JsonDec decodes string in json format.
JsonEnc encodes value to json string.
JsonMustDec useit as JsonDec but panics on error.
JsonMustEnc useit as JsonEnc but panics on error.
MustDec useit as Dec but panics on error.
MustEnc useit as Enc but panics on error.
Normalize a string by removing all special characters and replacing it with Q + <hex representation>.
PrepareMobileNumber returns 0043664...
YamlDec decodes string in yaml format.
YamlEnc encodes value to yaml string.
YamlMustDec useit as YamlDec but panics on error.
YamlMustEnc useit as YamlEnc but panics on error.