Utils

package
v0.0.0-...-98a8980 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2018 License: MIT, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SOURCE_CHARACTERS      = "" /* 334-byte string literal not displayed */
	DESTINATION_CHARACTERS = "" /* 126-byte string literal not displayed */
)

Variables

View Source
var (
	ErrInvalidFormat    = errors.New("invalid format")
	ErrUnresolvableHost = errors.New("unresolvable host")
)

*

View Source
var (
	ErrEmailBadFormat = errors.New("invalid format")
)

Functions

func ConcatArrUint32

func ConcatArrUint32(r []uint32) string

ConcatArrUint32 ...

func ConcatArrUint64

func ConcatArrUint64(r []uint64) string

ConcatArrUint64 ...

func ConcatCopyPreAllocate

func ConcatCopyPreAllocate(slices [][]byte) []byte

ConcatCopyPreAllocate ..

func DoHTTP

func DoHTTP(client *http.Client, req *http.Request) (resp []byte, isTimeout bool, statusCode int, err error)

DoHTTP do http (GET, PUT, POST ...)

func ExtractYoutubeVideoID

func ExtractYoutubeVideoID(url string) string

ExtractYoutubeVideoID ...

func GetVNTelcoByPhone

func GetVNTelcoByPhone(phone string) string

GetVNTelcoByPhone ...

func HTTPPost

func HTTPPost(client *http.Client, uri string, data url.Values) (resp []byte, err error)

HTTPPost do http post with timeout

func Hash

func Hash(hash crypto.Hash, toHash []byte) []byte

Hash do hash

func Int16ToBytes

func Int16ToBytes(num int16) []byte

Int16ToBytes ...

func Int32ToBytes

func Int32ToBytes(num int32) []byte

Int32ToBytes ...

func Int64ToBytes

func Int64ToBytes(num int64) []byte

Int64ToBytes ...

func IsATMCard

func IsATMCard(cardScheme string) bool

IsATMCard check if card scheme is atm card or not

func IsUnicode

func IsUnicode(input string) bool

IsUnicode check is unicode string

func MakeURL

func MakeURL(scheme, host, path string, args url.Values) string

MakeURL encode to full url request

func MakeYoutubeEmbedLink(url string) string

MakeYoutubeEmbedLink ...

func MonthBetween

func MonthBetween(t1, t2 time.Time) int

MonthBetween total months between time point

func Normalize

func Normalize(email string) string

Normalize normalizes email address.

func PrettyJSON

func PrettyJSON(data interface{}) (string, error)

PrettyJSON parse object to json string and make it pretty

func Round

func Round(num float64) int

Round ...

func StandardizePhone

func StandardizePhone(phone string) string

StandardizePhone ...

func StripNonAlphabet

func StripNonAlphabet(input string) string

StripNonAlphabet ...

func ToFixed

func ToFixed(num float64, precision int) float64

ToFixed ...

func TransformVietnamese

func TransformVietnamese(inp string) string

TransformVietnamese into "khong dau"

func Uint16ToBytes

func Uint16ToBytes(num uint16) []byte

Uint16ToBytes ...

func Uint32ToBytes

func Uint32ToBytes(num uint32) []byte

Uint32ToBytes ...

func Uint64ToBytes

func Uint64ToBytes(num uint64) []byte

Uint64ToBytes ...

func Validate

func Validate(email string) error

Validate checks format of a given email and resolves its host name.

func ValidateEmailFormat

func ValidateEmailFormat(email string) error

ValidateEmailFormat validate email format

func ValidateFast

func ValidateFast(email string) (host string, err error)

ValidateFast checks format of a given email.

func ValidateVNPhoneNumber

func ValidateVNPhoneNumber(phone string) bool

ValidateVNPhoneNumber ...

func ValidateYoutubeURL

func ValidateYoutubeURL(url string) bool

ValidateYoutubeURL ...

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL