Documentation
¶
Index ¶
- Constants
- func ArrayStringPointerToArrayInt64(s *[]*string) []int64
- func BoolPointerToBool(b *bool) bool
- func BoolToString(b bool) string
- func Contains[T comparable](a []T, x T) bool
- func ContainsInt64(a []int64, x int64) bool
- func ContainsString(a []string, x string) bool
- func Difference[T comparable](slice1 []T, slice2 []T) []T
- func DifferenceInt64(slice1 []int64, slice2 []int64) []int64
- func DifferenceString(slice1 []string, slice2 []string) []string
- func Dump(i interface{}) string
- func DumpIncomingContext(c context.Context) string
- func DumpOutGoingContext(c context.Context) string
- func Float64PointerToFloat64(f *float64) float64
- func FormatMoney(value decimal.Decimal, currencyCode string) string
- func FormatTimeRFC3339(t *time.Time) (s string)
- func FormatToIndonesianMoney(dec decimal.Decimal) string
- func FormatToWesternIndonesianTime(layout string, t *time.Time) string
- func GenerateID() int64
- func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType string) string
- func GenerateRandomAlphanumeric(n int) string
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- func GenerateULIDFromTime(t time.Time) string
- func GetDifferenceDaysForHumans(startsAt time.Time, endsAt time.Time) string
- func GetIDFromSlug(slug string) string
- func GraphQLIDPointerToInt32(id *graphql.ID) int32
- func GraphQLIDPointerToInt64(id *graphql.ID) int64
- func GraphQLIDPointerToString(id *graphql.ID) string
- func GraphQLIDToInt32(id graphql.ID) int32
- func GraphQLIDToInt64(id graphql.ID) int64
- func GraphQLIDToString(id graphql.ID) string
- func Int32PointerToInt32(i *int32) int32
- func Int32PointerToInt64(i *int32) int64
- func Int64MillisToPointerTime(millis int64) *time.Time
- func Int64MillisToTime(millis int64) time.Time
- func Int64ToGraphQLID(i int64) graphql.ID
- func Int64ToString(i int64) string
- func Int64WithLimit(input int64, limit int64) int64
- func Int64WithMinAndMaxLimit(input, min, max int64) int64
- func InterfaceBytesToInt64(i interface{}) int64
- func InterfaceBytesToType[T any](i interface{}) (out T)
- func IsEmailValid(email string) bool
- func IsNumeric(s string) bool
- func IsSameSliceIgnoreOrder(a, b []int64) bool
- func JoinURL(baseURL string, pathElements ...string) (string, error)
- func LowerMapStringKey(v map[string]interface{}) map[string]interface{}
- func MyCaller(skip int) string
- func Offset(page, limit int64) int64
- func RegexEmail() *regexp.Regexp
- func Retry(attempts int, sleep time.Duration, fn func() error) error
- func SliceAtoi(s []string) ([]int, error)
- func SlicePointerInt32PointerToSliceInt64(i *[]*int32) (result []int64)
- func StandardizeSpaces(s string) string
- func StringMillisToPointerTime(millis string) *time.Time
- func StringMillisToTime(millis string) time.Time
- func StringPointerToFloat64(s *string) float64
- func StringPointerToInt64(s *string) int64
- func StringPointerToString(s *string) string
- func StringToBool(s string) bool
- func StringToInt64(s string) int64
- func StringToInt64WithDefault(s string, d int64) int64
- func StripHTML(s string) string
- func Ternary(condition bool, a, b interface{}) interface{}
- func ToByte(i interface{}) []byte
- func TruncateString(str string, num int) string
- func UnescapeString(str string) (ustr string)
- func Unique[T comparable](elements []T) (result []T)
- func UniqueInt64(elements []int64) []int64
- func UniqueString(elements []string) []string
- type Hook
- func (hook *Hook) AddTag(key, value string)
- func (hook *Hook) Fire(entry *logrus.Entry) error
- func (hook *Hook) Flush()
- func (hook *Hook) Levels() []logrus.Level
- func (hook *Hook) SetEnvironment(environment string)
- func (hook *Hook) SetFlushTimeout(timeout time.Duration)
- func (hook *Hook) SetPrefix(prefix string)
- func (hook *Hook) SetRelease(release string)
- func (hook *Hook) SetTags(tags map[string]string)
- type RetryStopper
Constants ¶
const ( // BigPicture :nodoc: BigPicture = "big_picture" // LargeIcon :nodoc: LargeIcon = "large_icon" // IOSAttachment :nodoc: IOSAttachment = "ios_attahcment" )
Variables ¶
This section is empty.
Functions ¶
func ArrayStringPointerToArrayInt64 ¶
ArrayStringPointerToArrayInt64 :nodoc:
func Contains ¶ added in v1.21.0
func Contains[T comparable](a []T, x T) bool
Contains tells whether slice A contains x.
func ContainsInt64 ¶
ContainsInt64 tells whether a slice contains x.
func ContainsString ¶
ContainsString tells whether a slice contains x.
func Difference ¶ added in v1.21.0
func Difference[T comparable](slice1 []T, slice2 []T) []T
Difference get discrepancies between 2 slices
func DifferenceInt64 ¶
DifferenceInt64 :nodoc:
func DifferenceString ¶
DifferenceString :nodoc:
func DumpIncomingContext ¶
DumpIncomingContext :nodoc:
func DumpOutGoingContext ¶
DumpOutGoingContext :nodoc:
func Float64PointerToFloat64 ¶
Float64PointerToFloat64 :nodoc:
func FormatMoney ¶ added in v1.9.0
FormatMoney format money by currency code (ISO 4217)
func FormatTimeRFC3339 ¶
FormatTimeRFC3339 Format time according to RFC3339Nano
func FormatToIndonesianMoney ¶ added in v1.7.1
FormatToIndonesianMoney format money into Indonesian example: Rp10.000.000
func FormatToWesternIndonesianTime ¶ added in v1.7.1
FormatToWesternIndonesianTime format to western indonesian time expected format: 12 April 2020 14:30 WIB
func GeneratePushNotificationMediaURL ¶ added in v1.1.0
GeneratePushNotificationMediaURL Generates manipulated media URL for push notification purpose e.g. GeneratePushNotificationMediaURL("http://mycdn.com", "http://my.image.com/image/upload/v123/image.jpg", LargeIcon) => http://mycdn.com/image/upload/v123/image.jpg
func GenerateRandomAlphanumeric ¶ added in v1.4.0
GenerateRandomAlphanumeric Generate random alphanumeric character adapted from https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go
func GenerateRandomBytes ¶
GenerateRandomBytes adapted from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/ GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomStringURLSafe ¶
GenerateRandomStringURLSafe returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateULIDFromTime ¶ added in v1.22.0
func GetDifferenceDaysForHumans ¶ added in v1.13.0
GetDifferenceDaysForHumans return difference days for humans in indonesian language
func GraphQLIDPointerToInt32 ¶
GraphQLIDPointerToInt32 :nodoc:
func GraphQLIDPointerToInt64 ¶
GraphQLIDPointerToInt64 :nodoc:
func GraphQLIDPointerToString ¶
GraphQLIDPointerToString :nodoc:
func Int64MillisToPointerTime ¶ added in v1.11.0
Int64MillisToPointerTime convert millis to pointer time in UTC
func Int64MillisToTime ¶ added in v1.11.0
Int64MillisToTime convert millis to time in UTC
func Int64WithLimit ¶
Int64WithLimit -> Check req value bigger or not from limit.
func Int64WithMinAndMaxLimit ¶ added in v1.20.0
Int64WithMinAndMaxLimit check input value. if bigger than max, then return max. if smaller than min, then return min. else return input.
func InterfaceBytesToInt64 ¶
func InterfaceBytesToInt64(i interface{}) int64
InterfaceBytesToInt64 will transform cached value that get from the redis to Int64
func InterfaceBytesToType ¶ added in v1.21.0
func InterfaceBytesToType[T any](i interface{}) (out T)
InterfaceBytesToType will transform cached value that get from the redis to any types
func IsSameSliceIgnoreOrder ¶
IsSameSliceIgnoreOrder to compare slice without order
func LowerMapStringKey ¶ added in v1.3.0
LowerMapStringKey :nodoc:
func MyCaller ¶ added in v1.2.0
MyCaller will return the method caller. skip value defines how many steps to be skipped. skip=0 will always return the MyCaller skip=1 returns the caller of the MyCaller and so on...
func SlicePointerInt32PointerToSliceInt64 ¶
SlicePointerInt32PointerToSliceInt64 :nodoc:
func StandardizeSpaces ¶
StandardizeSpaces -> JoinURL long query to one line query
func StringMillisToPointerTime ¶ added in v1.10.0
StringMillisToPointerTime convert millis to pointer time in UTC
func StringMillisToTime ¶ added in v1.10.0
StringMillisToTime convert millis to time in UTC
func StringPointerToFloat64 ¶
StringPointerToFloat64 :nodoc:
func StringPointerToString ¶
StringPointerToString :nodoc:
func StringToInt64WithDefault ¶
StringToInt64WithDefault :nodoc:
func Ternary ¶
func Ternary(condition bool, a, b interface{}) interface{}
Ternary if condition is true, return a else b
func TruncateString ¶ added in v1.7.0
TruncateString by length, and add ellipsis at the end
func UnescapeString ¶
UnescapeString UTF-8 string e.g. convert "\u0e27\u0e23\u0e0d\u0e32" to "วรญา"
func Unique ¶ added in v1.21.0
func Unique[T comparable](elements []T) (result []T)
Unique returns unique value in as slice
Types ¶
type Hook ¶ added in v1.15.0
type Hook struct {
// contains filtered or unexported fields
}
Hook "the hook"
func (*Hook) SetEnvironment ¶ added in v1.15.0
SetEnvironment implements SetEnvironment
func (*Hook) SetFlushTimeout ¶ added in v1.15.0
SetFlushTimeout implements SetFlushTimeout
func (*Hook) SetRelease ¶ added in v1.15.0
SetRelease implements SetRelease
type RetryStopper ¶
type RetryStopper struct {
// contains filtered or unexported fields
}
RetryStopper :nodoc:
func NewRetryStopper ¶ added in v1.3.1
func NewRetryStopper(err error) RetryStopper
NewRetryStopper :nodoc: