Documentation
¶
Index ¶
- Constants
- func ArrayStringPointerToArrayInt64(s *[]*string) []int64
- func BoolPointerToBool(b *bool) bool
- func BoolToString(b bool) string
- func ContainsInt64(a []int64, x int64) bool
- func ContainsString(a []string, x string) bool
- 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 FormatTimeRFC3339(t *time.Time) (s string)
- func GenerateID() int64
- func GeneratePushNotificationMediaURL(cdnURL, mediaSrcURL, imageType string) string
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(n int) (string, error)
- func GenerateRandomStringURLSafe(n int) (string, error)
- 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 Int64ToGraphQLID(i int64) graphql.ID
- func Int64ToString(i int64) string
- func Int64WithLimit(input int64, limit int64) int64
- func InterfaceBytesToInt64(i interface{}) int64
- func IsEmailValid(email string) bool
- func IsNumeric(s string) bool
- func IsSameSliceIgnoreOrder(a, b []int64) bool
- func JoinURL(base, url string) (string, error)
- 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 SplitNetLocation(url string, start int) (domain, rest string)
- func StandardizeSpaces(s string) string
- 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 Ternary(condition bool, a, b interface{}) interface{}
- func ToByte(i interface{}) []byte
- func UnescapeString(str string) (ustr string)
- func UniqueInt64(elements []int64) []int64
- func UniqueString(elements []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 ContainsInt64 ¶
ContainsInt64 tells whether a slice contains x.
func ContainsString ¶
ContainsString tells whether a slice contains x.
func DifferenceInt64 ¶
DifferenceInt64 :nodoc:
func DifferenceString ¶
DifferenceString :nodoc:
func DumpIncomingContext ¶
DumpIncomingContext :nodoc:
func DumpOutGoingContext ¶
DumpOutGoingContext :nodoc:
func Float64PointerToFloat64 ¶
Float64PointerToFloat64 :nodoc:
func FormatTimeRFC3339 ¶
FormatTimeRFC3339 Format time according to RFC3339Nano
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 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 GraphQLIDPointerToInt32 ¶
GraphQLIDPointerToInt32 :nodoc:
func GraphQLIDPointerToInt64 ¶
GraphQLIDPointerToInt64 :nodoc:
func GraphQLIDPointerToString ¶
GraphQLIDPointerToString :nodoc:
func Int64WithLimit ¶
Int64WithLimit -> Check req value bigger or not from limit.
func InterfaceBytesToInt64 ¶
func InterfaceBytesToInt64(i interface{}) int64
InterfaceBytesToInt64 will transform cached value that get from the redis to Int64
func IsSameSliceIgnoreOrder ¶
IsSameSliceIgnoreOrder to compare slice without order
func JoinURL ¶
JoinURL is to join base URL with another URL/path/directory based on python lib urljoin e.g. JoinURL(https://kumparan.com/trending , feed/category) => https://kumparan.com/feed/category
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 SplitNetLocation ¶
SplitNetLocation is to get net location
func StandardizeSpaces ¶
StandardizeSpaces -> JoinURL long query to one line query
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 UnescapeString ¶
UnescapeString UTF-8 string e.g. convert "\u0e27\u0e23\u0e0d\u0e32" to "วรญา"
Types ¶
type RetryStopper ¶
type RetryStopper struct {
// contains filtered or unexported fields
}
RetryStopper :nodoc: