utils

package
v0.0.0-...-162f8c7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOffset = uint64(0)
	DefaultLimit  = uint64(20)
)

Variables

This section is empty.

Functions

func CamelCaseToUnderscore

func CamelCaseToUnderscore(str string) string

func FindString

func FindString(array []string, str string) int

func GetLimitFromRequest

func GetLimitFromRequest(req RequestHadLimit) uint64

func GetOffsetFromRequest

func GetOffsetFromRequest(req RequestHadOffset) uint64

func GetUuid

func GetUuid(prefix string) string

func HttpGet

func HttpGet(url string) (*http.Response, error)

func In

func In(value interface{}, container interface{}) bool

func StringIn

func StringIn(str string, array []string) bool

func ToProtoString

func ToProtoString(str string) *wrappers.StringValue

func ToProtoTimestamp

func ToProtoTimestamp(t time.Time) (tt *timestamp.Timestamp)

func ToProtoUInt32

func ToProtoUInt32(uint32 uint32) *wrappers.UInt32Value

func WaitForSpecificOrError

func WaitForSpecificOrError(f func() (bool, error), timeout time.Duration, waitInterval time.Duration) error

WaitForSpecificOrError wait a function return true or error.

Types

type Counter

type Counter int32

func (*Counter) Add

func (c *Counter) Add(n int32) int32

func (*Counter) Get

func (c *Counter) Get() int32

type RequestHadLimit

type RequestHadLimit interface {
	GetLimit() uint32
}

type RequestHadOffset

type RequestHadOffset interface {
	GetOffset() uint32
}

type TimeoutError

type TimeoutError struct {
	// contains filtered or unexported fields
}

Reference: https://github.com/yunify/qingcloud-sdk-go/blob/f1702ea44452e2d6b6048608c070237cd45088d6/utils/wait.go TimeoutError An Error represents a timeout error.

func NewTimeoutError

func NewTimeoutError(timeout time.Duration) *TimeoutError

NewTimeoutError create a new TimeoutError

func (*TimeoutError) Error

func (e *TimeoutError) Error() string

Error message

func (*TimeoutError) Timeout

func (e *TimeoutError) Timeout() time.Duration

Timeout duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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