# README
go-utils
Utility function for go
# Functions
ArrayStringPointerToArrayInt64 :nodoc:.
BoolPointerToBool :nodoc:.
BoolToString :nodoc:.
Contains tells whether slice A contains x.
ContainsInt64 tells whether a slice contains x.
ContainsString tells whether a slice contains x.
ConvertSlice can change slice data type or even manipulate the data using converter func.
DeleteByValue use for delete value in slice.
Difference get discrepancies between 2 slices.
DifferenceInt64 :nodoc:.
DifferenceString :nodoc:.
DoHTTPRequest generic do http request using ctxhttp.
Dump to json using json marshal.
DumpIncomingContext :nodoc:.
DumpOutGoingContext :nodoc:.
EscapeQuote :nodoc:.
FindDifferencesFromSlices find item that not exists in all slices but exists in one or more of them.
Float64PointerToFloat64 :nodoc:.
FormatMoney format money by currency code (ISO 4217).
FormatTimeRFC3339 Format time according to RFC3339Nano.
FormatToIndonesianMoney format money into Indonesian example: Rp10.000.000.
FormatToWesternIndonesianTime format to western indonesian time expected format: 12 April 2020 14:30 WIB.
GenerateID based on current time.
GeneratePushNotificationMediaURL Generates manipulated media URL for push notification purpose e.g.
GenerateRandomAlphanumeric Generate random alphanumeric character adapted from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go.
GenerateRandomBytes adapted from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/ GenerateRandomBytes returns securely generated random bytes.
GenerateRandomString returns a securely generated random string.
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string.
GenerateULIDFromTime :nodoc:.
GenerateUUID generate random UUID v4.
GetCronNextAt supports - Standard crontab specs, e.g.
GetDifferenceDaysForHumans return difference days for humans in indonesian language.
GetIDFromSlug in base62.
GraphQLIDPointerToInt32 Deprecated.
GraphQLIDPointerToInt64 :nodoc:.
GraphQLIDPointerToString :nodoc:.
GraphQLIDToInt32 Deprecated.
GraphQLIDToInt64 :nodoc:.
GraphQLIDToString :nodoc:.
Int32PointerToInt32 :nodoc:.
Int32PointerToInt64 :nodoc:.
Int64MillisToPointerTime convert millis to pointer time in UTC.
Int64MillisToTime convert millis to time in UTC.
Int64PointerToInt64 :nodoc:.
Int64ToGraphQLID :nodoc:.
Int64ToString :nodoc:.
Int64WithLimit -> Check req value bigger or not from limit.
Int64WithMinAndMaxLimit check input value.
InterfaceBytesToInt64 will transform cached value that get from the redis to Int64.
InterfaceBytesToType will transform cached value that get from the redis to any types.
IsEmailValid -> validate email using regex.
IsNumeric -> Check if input string is int.
IsSameSliceIgnoreOrder to compare slice without order.
IsUniqueSliceItem :nodoc:.
IsURLReachable check is the url reachable.
JoinURL joins URL with the path elements.
LowerMapStringKey :nodoc:.
MapValuesToOrderedSlice convert map values to ordered slice.
MyCaller will return the method caller.
NewHook Initiate new hook.
NewRetryStopper :nodoc:.
Offset to get offset from page and limit, minimum value for page = 1.
PaginateSlice :nodoc:.
ParseDurationWithDefault self explained.
RegexEmail returns regex for email.
Retry :nodoc:.
SliceAtoi -> convert array of string to array of integer.
SlicePointerInt32PointerToSliceInt64 :nodoc:.
StandardizeSpaces -> JoinURL long query to one line query.
StringMillisToPointerTime convert millis to pointer time in UTC.
StringMillisToTime convert millis to time in UTC.
StringPointerToFloat64 :nodoc:.
StringPointerToInt64 :nodoc:.
StringPointerToString :nodoc:.
StringToBool :nodoc:.
StringToInt64 :nodoc:.
StringToInt64WithDefault :nodoc:.
StripHTML strips all HTML from a string, duh.
Ternary if condition is true, return a else b.
TimeFromObjectIDHex extracts time data from bson's objectID.
ToByte :nodoc:.
TrimSpacePointerString :nodoc:.
TruncateString by length, and add ellipsis at the end.
UnescapeString UTF-8 string e.g.
Unique returns unique value in as slice.
UniqueInt64 :nodoc:.
UniqueString :nodoc:.
ValueOfPointer return value of pointer T.
ValueOrDefault use the given value or use default value if the value = empty value.