package
0.3.19
Repository: https://github.com/romberli/go-util.git
Documentation: pkg.go.dev

# Functions

BytesToString converts byte slice type to string.
CheckIdentifier checks if the given string is a valid identifier.
CheckIdentifierWithDefault checks if the given string is a valid identifier, if not, return the default value.
CheckPasswordStrength checks the strength of password.
CheckPasswordStrengthWithDefault checks the strength of password with default parameters.
CombineMessageWithError returns a new string which combines given message and error.
ConvertInterfaceSliceToString converts the interface slice to string, it uses c as the separation character.
ConvertInterfaceToMapInterfaceInterface converts input data which must be map type to map interface interface, it means each pair of key and value in the map will be interface type.
ConvertInterfaceToSliceInterface converts input data which must be slice type to interface slice, it means each element in the slice is interface type.
ConvertNumberToString tries to convert number to string, if input is neither number type nor string, it will return error.
ConvertSliceToString converts the slice to string, it uses c as the separation character.
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
CopyStructWithFields returns a new struct with only specified fields NOTE: 1.
CopyStructWithoutFields returns a new struct without specified fields, there are something you should know.
ElementInSlice checks if given element is in the slice.
ElementInSliceInterface checks if given element is in the slice.
GetParentDir returns the parent directory of the given path, it will not change the separate character.
No description provided by the author
GetRandomDigitalString returns a random string with given length.
GetRandomNormalCharString returns a random string with given length.
GetRandomSpecialString returns a random string with given length.
GetRandomString returns a random string from given string with given length.
GetRandomStringWithDefault returns a random string with default length.
GetValueOfStruct get value of specified field of input struct, the fields must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct.
IntersectSlice returns the intersection of two slices.
IsAbs returns if given path is an absolute path, this function is not related to the platform, it works for both unix like and windows paths.
IsAbsUnix returns if given path is an absolute path of unix like system.
IsAbsUnix returns if given path is an absolute path of windows system.
IsRandomValue checks if given value is a random value.
KeyInMap checks if given key is in the map.
KeyPathExists checks if the key path exists in the json data.
MarshalStructWithFields marshals input struct using json.Marshal() with given fields, first argument must be a pointer to struct, not the struct itself.
MarshalStructWithoutFields marshals input struct using json.Marshal() without given fields, first argument must be a pointer to struct, not the struct itself.
MarshalStructWithTag marshals input struct using json.Marshal() with fields that contain given tag, first argument must be a pointer to struct, not the struct itself.
NewBucket returns a new *Bucket.
NewMapWithStructTag returns a new map as the result, it loops the keys of given map and tags of the struct, if key and tag are same, the field of the input struct will be the key of the new map, the value of the given map will be the value of the new map.
NewRetryOption returns RetryOption.
NewRetryOptionWithDefault returns RetryOption with default values.
NewRetryOptionWithLogger returns RetryOption with given logger.
NewTimer returns a new *Timer.
NewTimerWithDefault returns a new *Timer.
No description provided by the author
No description provided by the author
No description provided by the author
Retry retries the function until it returns no error or reaches max retry count or max wait time, either one is earlier, if option is nil, it will only call the function once, and no retry.
ReverseString reverses a string.
SetRandomValueToNil set each value in slice values if value is a random value.
SetValueOfStruct sets value of specified field of input struct, the fields must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct if value is nil, the field value will be set to ZERO value of the type.
No description provided by the author
SetValueOfStructByTag sets value of specified field of input struct, field in this function represents the tag of the struct field, the concerning struct field must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct if value is nil, the field value will be set to ZERO value of the type.
SetValuesWithMap sets values of input struct with given map, the fields of map must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct.
SetValuesWithMapAndRandom sets values of input struct with given map, if fields in struct does not exist in given map, some of them--depends on the data type--will be set with default value, the fields of map must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct.
SetValuesWithMapAndRandomByTag sets values of input struct with given map, field in this function represents the tag of the struct field, if fields in struct does not exist in given map, some of them--depends on the data type--will be set with default value, the fields of map must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct.
SetValuesWithMapByTag sets values of input struct with given map, the fields of map represents the tag of the struct field, the concerning struct field must exist and be exported, otherwise, it will return an error, the first argument must be a pointer to struct.
StringKeyInMap checks if a string key is in the map.
StringToBytes converts string type to byte slice.
SubtractSlice returns all the elements in first but not in second.
TrimSpaceOfStructString trims spaces of each member variable of the struct.
UnionSlice returns the union of two slices.
UnmarshalToMapWithStructTag returns a map as the result, it works as following logic: 1.
UnmarshalToMapWithStructTagFromString converts given string to []byte and then call UnmarshalToMapWithStructTag() function.
ValueInMap checks if given value is in the map.

# Constants

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
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
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

# Structs

No description provided by the author
RetryOption is options for Retry().
No description provided by the author

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author