Documentation ¶
Index ¶
- func AllowRetry(retry interface{}, retryTimes int) bool
- func AssertContains(t *testing.T, contains string, msgAndArgs ...string)
- func AssertEqual(t *testing.T, a, b interface{})
- func AssertNil(t *testing.T, object interface{})
- func AssertNotNil(t *testing.T, object interface{})
- func Convert(in interface{}, out interface{}) error
- func GetBackoffTime(backoff interface{}, retrytimes int) int
- func InitLogMsg(fieldMap map[string]string)
- func Merge(args ...interface{}) map[string]string
- func NewCastError(message string) (err error)
- func Prettify(i interface{}) string
- func PublishProgress(listener ProgressListener, event *ProgressEvent)
- func Retryable(err error) bool
- func SetLogChannel(channel string)
- func Sleep(backoffTime int)
- func ToMap(args ...interface{}) map[string]interface{}
- func ToObject(obj interface{}) map[string]interface{}
- func ToReader(obj interface{}) io.Reader
- func ToString(val interface{}) string
- func TransInterfaceToBool(val interface{}) bool
- func TransInterfaceToInt(val interface{}) int
- func TransInterfaceToString(val interface{}) string
- func TransToString(object interface{}) string
- func Validate(params interface{}) error
- type CastError
- type Debug
- type Logger
- func (logger *Logger) CloseLogger()
- func (logger *Logger) GetFormatTemplate() string
- func (logger *Logger) GetIsopen() bool
- func (logger *Logger) GetLastLogMsg() string
- func (logger *Logger) OpenLogger()
- func (logger *Logger) PrintLog(fieldMap map[string]string, err error)
- func (logger *Logger) SetFormatTemplate(template string)
- func (logger *Logger) SetIsopen(isopen bool)
- func (logger *Logger) SetLastLogMsg(lastLogMsg string)
- type ProgressEvent
- type ProgressEventType
- type ProgressListener
- type ReaderTracker
- type Request
- type Response
- type RuntimeObject
- type SDKError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowRetry ¶
func AssertEqual ¶
func AssertNotNil ¶
func Convert ¶
func Convert(in interface{}, out interface{}) error
Convert is use convert map[string]interface object to struct
func GetBackoffTime ¶
func InitLogMsg ¶
func NewCastError ¶
NewCastError is used for cast type fails
func PublishProgress ¶
func PublishProgress(listener ProgressListener, event *ProgressEvent)
publishProgress
func SetLogChannel ¶
func SetLogChannel(channel string)
func TransInterfaceToBool ¶
func TransInterfaceToBool(val interface{}) bool
func TransInterfaceToInt ¶
func TransInterfaceToInt(val interface{}) int
func TransInterfaceToString ¶
func TransInterfaceToString(val interface{}) string
func TransToString ¶
func TransToString(object interface{}) string
Types ¶
type Logger ¶
func (*Logger) CloseLogger ¶
func (logger *Logger) CloseLogger()
func (*Logger) GetFormatTemplate ¶
func (*Logger) GetLastLogMsg ¶
func (*Logger) OpenLogger ¶
func (logger *Logger) OpenLogger()
func (*Logger) SetFormatTemplate ¶
func (*Logger) SetLastLogMsg ¶
type ProgressEvent ¶
type ProgressEvent struct { ConsumedBytes int64 TotalBytes int64 RwBytes int64 EventType ProgressEventType }
ProgressEvent defines progress event
func NewProgressEvent ¶
func NewProgressEvent(eventType ProgressEventType, consumed, total int64, rwBytes int64) *ProgressEvent
type ProgressEventType ¶
type ProgressEventType int
ProgressEventType defines transfer progress event type
const ( // TransferStartedEvent transfer started, set TotalBytes TransferStartedEvent ProgressEventType = 1 + iota // TransferDataEvent transfer data, set ConsumedBytes anmd TotalBytes TransferDataEvent // TransferCompletedEvent transfer completed TransferCompletedEvent // TransferFailedEvent transfer encounters an error TransferFailedEvent )
type ProgressListener ¶
type ProgressListener interface {
ProgressChanged(event *ProgressEvent)
}
ProgressListener listens progress change
func GetProgressListener ¶
func GetProgressListener(obj interface{}) ProgressListener
type ReaderTracker ¶
type ReaderTracker struct {
CompletedBytes int64
}
type Request ¶
type Request struct { Protocol string Port int Method string Pathname string Domain string Headers map[string]string Query map[string]string Body io.Reader }
Request is used wrap http request
type Response ¶
type Response struct { Body io.ReadCloser StatusCode int StatusMessage string Headers map[string]string }
Response is use d wrap http response
func DoRequest ¶
func DoRequest(request *Request, requestRuntime map[string]interface{}) (response *Response, err error)
DoRequest is used send request to server
func NewResponse ¶
NewResponse is create response with http response
type RuntimeObject ¶
type RuntimeObject struct { IgnoreSSL bool `json:"ignoreSSL" xml:"ignoreSSL"` ReadTimeout int `json:"readTimeout" xml:"readTimeout"` ConnectTimeout int `json:"connectTimeout" xml:"connectTimeout"` LocalAddr string `json:"localAddr" xml:"localAddr"` HttpProxy string `json:"httpProxy" xml:"httpProxy"` HttpsProxy string `json:"httpsProxy" xml:"httpsProxy"` NoProxy string `json:"noProxy" xml:"noProxy"` MaxIdleConns int `json:"maxIdleConns" xml:"maxIdleConns"` Socks5Proxy string `json:"socks5Proxy" xml:"socks5Proxy"` Socks5NetWork string `json:"socks5NetWork" xml:"socks5NetWork"` Listener ProgressListener `json:"listener" xml:"listener"` Tracker *ReaderTracker `json:"tracker" xml:"tracker"` Logger *Logger `json:"logger" xml:"logger"` }
RuntimeObject is used for converting http configuration
func NewRuntimeObject ¶
func NewRuntimeObject(runtime map[string]interface{}) *RuntimeObject
NewRuntimeObject is used for shortly create runtime object
type SDKError ¶
SDKError struct is used save error code and message
func NewSDKError ¶
NewSDKError is used for shortly create SDKError object
Click to show internal directories.
Click to hide internal directories.