Documentation
¶
Index ¶
- Constants
- func AllowRetry(retry interface{}, retryTimes *int) *bool
- func ArrAppend(arr interface{}, value interface{}, index int)
- func ArrContains(arr interface{}, value interface{}) bool
- func ArrIndex(arr interface{}, value interface{}) int
- func ArrJoin(arr interface{}, sep string) string
- func ArrPop(arr interface{}) interface{}
- func ArrPush(arr interface{}, value interface{}) int
- func ArrRemove(arr interface{}, value interface{})
- func ArrShift(arr interface{}) interface{}
- func ArrUnshift(arr interface{}, value interface{}) int
- func Bool(a bool) *bool
- func BoolSlice(a []bool) []*bool
- func BoolSliceValue(a []*bool) []bool
- func BoolValue(a *bool) bool
- func BytesFromString(str string, typeStr string) []byte
- func ConcatArr(arr1 interface{}, arr2 interface{}) interface{}
- func Convert(in interface{}, out interface{}) error
- func CreateReadStream(path string) (*os.File, error)
- func CreateWriteStream(path string) (*os.File, error)
- func Default(inputValue interface{}, defaultValue interface{}) (_result interface{})
- func EncodeURL(urlStr string) string
- func Exists(path string) (bool, error)
- func Float32(a float32) *float32
- func Float32Slice(a []float32) []*float32
- func Float32Value(a *float32) float32
- func Float32ValueSlice(a []*float32) []float32
- func Float64(a float64) *float64
- func Float64Slice(a []float64) []*float64
- func Float64Value(a *float64) float64
- func Float64ValueSlice(a []*float64) []float64
- func Floor(n Number) int
- func ForceBoolean(a interface{}) bool
- func ForceFloat32(a interface{}) float32
- func ForceFloat64(a interface{}) float64
- func ForceInt(a interface{}) int
- func ForceInt16(a interface{}) int16
- func ForceInt32(a interface{}) int32
- func ForceInt64(a interface{}) int64
- func ForceInt8(a interface{}) int8
- func ForceUInt16(a interface{}) uint16
- func ForceUInt32(a interface{}) uint32
- func ForceUInt8(a interface{}) uint8
- func ForceUint64(a interface{}) uint64
- func GetBackoffDelay(options *RetryOptions, ctx *RetryPolicyContext) int
- func GetBackoffTime(backoff interface{}, retrytimes *int) *int
- func GetBoundary() string
- func Int(a int) *int
- func Int16(a int16) *int16
- func Int16Slice(a []int16) []*int16
- func Int16Value(a *int16) int16
- func Int16ValueSlice(a []*int16) []int16
- func Int32(a int32) *int32
- func Int32Slice(a []int32) []*int32
- func Int32Value(a *int32) int32
- func Int32ValueSlice(a []*int32) []int32
- func Int64(a int64) *int64
- func Int64Slice(a []int64) []*int64
- func Int64Value(a *int64) int64
- func Int64ValueSlice(a []*int64) []int64
- func Int8(a int8) *int8
- func Int8Slice(a []int8) []*int8
- func Int8Value(a *int8) int8
- func Int8ValueSlice(a []*int8) []int8
- func IntSlice(a []int) []*int
- func IntValue(a *int) int
- func IntValueSlice(a []*int) []int
- func IsNil(val interface{}) bool
- func KeySet(m interface{}) []string
- func Merge(args ...interface{}) map[string]*string
- func NewCastError(message *string) (err error)
- func ParseJSON(a string) interface{}
- func ParseXml(val string, result interface{}) map[string]interface{}
- func PathEncode(path string) string
- func PercentEncode(uri string) string
- func Prettify(i interface{}) string
- func Random() float64
- func ReadAsBytes(body io.Reader) ([]byte, error)
- func ReadAsJSON(body io.Reader) (result interface{}, err error)
- func ReadAsSSE(body io.ReadCloser, eventChannel chan *SSEEvent, errorChannel chan error)
- func ReadAsString(body io.Reader) (string, error)
- func Recover(in interface{}) error
- func Retryable(err error) *bool
- func Round(n Number) int
- func ShouldRetry(options *RetryOptions, ctx *RetryPolicyContext) bool
- func Sleep(backoffTime int)
- func SortArr(arr interface{}, order string) interface{}
- func String(a string) *string
- func StringSlice(a []string) []*string
- func StringSliceValue(a []*string) []string
- func StringValue(a *string) string
- func Stringify(a interface{}) string
- func TeaSDKError(err error) error
- func ToBytes(s, encodingType string) []byte
- func ToFileForm(body map[string]interface{}, boundary string) io.Reader
- func ToFormString(a map[string]interface{}) string
- func ToInt(a *int32) *int
- func ToInt32(a *int) *int32
- 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 ToWriter(obj interface{}) io.Writer
- func ToXML(obj map[string]interface{}) string
- func TransInterfaceToBool(val interface{}) *bool
- func TransInterfaceToInt(val interface{}) *int
- func TransInterfaceToString(val interface{}) *string
- func Uint(a uint) *uint
- func Uint16(a uint16) *uint16
- func Uint16Slice(a []uint16) []*uint16
- func Uint16Value(a *uint16) uint16
- func Uint16ValueSlice(a []*uint16) []uint16
- func Uint32(a uint32) *uint32
- func Uint32Slice(a []uint32) []*uint32
- func Uint32Value(a *uint32) uint32
- func Uint32ValueSlice(a []*uint32) []uint32
- func Uint64(a uint64) *uint64
- func Uint64Slice(a []uint64) []*uint64
- func Uint64Value(a *uint64) uint64
- func Uint64ValueSlice(a []*uint64) []uint64
- func Uint8(a uint8) *uint8
- func Uint8Slice(a []uint8) []*uint8
- func Uint8Value(a *uint8) uint8
- func Uint8ValueSlice(a []*uint8) []uint8
- func UintSlice(a []uint) []*uint
- func UintValue(a *uint) uint
- func UintValueSlice(a []*uint) []uint
- func Validate(params interface{}) error
- type BackoffPolicy
- type BaseError
- type CastError
- type DaraFile
- func (tf *DaraFile) Close() error
- func (tf *DaraFile) CreateTime() (*Date, error)
- func (tf *DaraFile) Length() (int64, error)
- func (tf *DaraFile) ModifyTime() (*Date, error)
- func (tf *DaraFile) Path() string
- func (tf *DaraFile) Read(size int) ([]byte, error)
- func (tf *DaraFile) Write(data []byte) error
- type Date
- func (t *Date) Add(amount int, unit string) *Date
- func (t *Date) DayOfMonth() int
- func (t *Date) DayOfWeek() int
- func (t *Date) Diff(amount string, diffDate *Date) int64
- func (t *Date) Format(layout string) string
- func (t *Date) Hour() int
- func (t *Date) Minute() int
- func (t *Date) Month() int
- func (t *Date) Second() int
- func (t *Date) Sub(amount int, unit string) *Date
- func (t *Date) UTC() string
- func (t *Date) Unix() int64
- func (t *Date) WeekOfYear() int
- func (t *Date) Year() int
- type Entry
- type EqualJitterBackoffPolicy
- type ExponentialBackoffPolicy
- type ExtendsParameters
- type FileField
- type FileFormReader
- type FixedBackoffPolicy
- type FullJitterBackoffPolicy
- type HttpClient
- type HttpRequest
- type HttpResponse
- type Model
- type Number
- type RandomBackoffPolicy
- type Request
- type Response
- type ResponseError
- type RetryCondition
- type RetryOptions
- type RetryPolicyContext
- type RuntimeObject
- type RuntimeOptions
- type SDKError
- type SSEEvent
- type URL
Constants ¶
const ( MAX_DELAY_TIME = 120 * 1000 // 120 seconds MIN_DELAY_TIME = 100 // 100 milliseconds DEFAULT_MAX_CAP = 3 * 24 * 60 * 60 * 1000 // 3 days in milliseconds MAX_ATTEMPTS = 3 )
Variables ¶
This section is empty.
Functions ¶
func AllowRetry ¶
func ArrAppend ¶
func ArrAppend(arr interface{}, value interface{}, index int)
ArrAppend inserts a new pointer at a specified index in a pointer array.
func ArrContains ¶
func ArrContains(arr interface{}, value interface{}) bool
ArrContains checks if an element is in the array
func ArrIndex ¶
func ArrIndex(arr interface{}, value interface{}) int
ArrIndex returns the index of the element in the array
func ArrPop ¶
func ArrPop(arr interface{}) interface{}
ArrPop removes the last element from the array
func ArrPush ¶
func ArrPush(arr interface{}, value interface{}) int
ArrPush adds an element to the end of the array
func ArrRemove ¶
func ArrRemove(arr interface{}, value interface{})
ArrRemove removes an element from the array
func ArrShift ¶
func ArrShift(arr interface{}) interface{}
ArrShift removes the first element from the array
func ArrUnshift ¶
func ArrUnshift(arr interface{}, value interface{}) int
ArrUnshift adds an element to the beginning of the array
func BoolSliceValue ¶
func BytesFromString ¶
func ConcatArr ¶
func ConcatArr(arr1 interface{}, arr2 interface{}) interface{}
ConcatArr concatenates two arrays
func Convert ¶
func Convert(in interface{}, out interface{}) error
Convert is use convert map[string]interface object to struct
func CreateReadStream ¶
CreateReadStream would typically return an os.File or similar
func CreateWriteStream ¶
CreateWriteStream would typically return an os.File or similar
func Float32Slice ¶
func Float32Value ¶
func Float32ValueSlice ¶
func Float64Slice ¶
func Float64Value ¶
func Float64ValueSlice ¶
func ForceBoolean ¶
func ForceBoolean(a interface{}) bool
func ForceFloat32 ¶
func ForceFloat32(a interface{}) float32
ForceFloat32 attempts to assert that a is of type float32.
func ForceFloat64 ¶
func ForceFloat64(a interface{}) float64
ForceFloat64 attempts to assert that a is of type float64.
func ForceInt16 ¶
func ForceInt16(a interface{}) int16
ForceInt16 attempts to assert that a is of type int16.
func ForceInt32 ¶
func ForceInt32(a interface{}) int32
ForceInt32 attempts to assert that a is of type int32.
func ForceInt64 ¶
func ForceInt64(a interface{}) int64
func ForceInt8 ¶
func ForceInt8(a interface{}) int8
ForceInt8 attempts to assert that a is of type int8.
func ForceUInt16 ¶
func ForceUInt16(a interface{}) uint16
ForceUInt16 attempts to assert that a is of type uint16.
func ForceUInt32 ¶
func ForceUInt32(a interface{}) uint32
ForceUInt32 attempts to assert that a is of type uint32.
func ForceUInt8 ¶
func ForceUInt8(a interface{}) uint8
ForceUInt8 attempts to assert that a is of type uint8.
func ForceUint64 ¶
func ForceUint64(a interface{}) uint64
func GetBackoffDelay ¶
func GetBackoffDelay(options *RetryOptions, ctx *RetryPolicyContext) int
getBackoffDelay calculates backoff delay
func GetBackoffTime ¶
func GetBoundary ¶
func GetBoundary() string
func Int16Slice ¶
func Int16Value ¶
func Int16ValueSlice ¶
func Int32Slice ¶
func Int32Value ¶
func Int32ValueSlice ¶
func Int64Slice ¶
func Int64Value ¶
func Int64ValueSlice ¶
func Int8ValueSlice ¶
func IntValueSlice ¶
func NewCastError ¶
NewCastError is used for cast type fails
func PercentEncode ¶
PercentEncode encodes a string for use in URLs, replacing certain characters.
func ReadAsJSON ¶
func ReadAsSSE ¶
func ReadAsSSE(body io.ReadCloser, eventChannel chan *SSEEvent, errorChannel chan error)
func ShouldRetry ¶
func ShouldRetry(options *RetryOptions, ctx *RetryPolicyContext) bool
shouldRetry determines if a retry should be attempted
func StringSlice ¶
func StringSliceValue ¶
func StringValue ¶
func TeaSDKError ¶ added in v1.3.2
func ToFormString ¶
func TransInterfaceToBool ¶
func TransInterfaceToBool(val interface{}) *bool
func TransInterfaceToInt ¶
func TransInterfaceToInt(val interface{}) *int
func TransInterfaceToString ¶
func TransInterfaceToString(val interface{}) *string
func Uint16Slice ¶
func Uint16Value ¶
func Uint16ValueSlice ¶
func Uint32Slice ¶
func Uint32Value ¶
func Uint32ValueSlice ¶
func Uint64Slice ¶
func Uint64Value ¶
func Uint64ValueSlice ¶
func Uint8Slice ¶
func Uint8Value ¶
func Uint8ValueSlice ¶
func UintValueSlice ¶
Types ¶
type BackoffPolicy ¶
type BackoffPolicy interface {
GetDelayTime(ctx *RetryPolicyContext) int
}
BackoffPolicy interface with a method to get delay time
func BackoffPolicyFactory ¶
func BackoffPolicyFactory(option map[string]interface{}) (BackoffPolicy, error)
BackoffPolicyFactory creates a BackoffPolicy based on the option
type DaraFile ¶
type DaraFile struct {
// contains filtered or unexported fields
}
File struct to represent the file
func (*DaraFile) CreateTime ¶
CreateTime returns the creation time of the file
func (*DaraFile) ModifyTime ¶
ModifyTime returns the modification time of the file
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
func (*Date) DayOfMonth ¶
func (*Date) WeekOfYear ¶
type EqualJitterBackoffPolicy ¶
EqualJitterBackoffPolicy implementation
func NewEqualJitterBackoffPolicy ¶
func NewEqualJitterBackoffPolicy(option map[string]interface{}) *EqualJitterBackoffPolicy
func (*EqualJitterBackoffPolicy) GetDelayTime ¶
func (e *EqualJitterBackoffPolicy) GetDelayTime(ctx *RetryPolicyContext) int
type ExponentialBackoffPolicy ¶
ExponentialBackoffPolicy implementation
func NewExponentialBackoffPolicy ¶
func NewExponentialBackoffPolicy(option map[string]interface{}) *ExponentialBackoffPolicy
func (*ExponentialBackoffPolicy) GetDelayTime ¶
func (e *ExponentialBackoffPolicy) GetDelayTime(ctx *RetryPolicyContext) int
type ExtendsParameters ¶
type ExtendsParameters = util.ExtendsParameters
type FileField ¶
type FileField struct { Filename *string `json:"filename" xml:"filename" require:"true"` ContentType *string `json:"content-type" xml:"content-type" require:"true"` Content io.Reader `json:"content" xml:"content" require:"true"` }
func (*FileField) SetContentType ¶
func (*FileField) SetFilename ¶
type FileFormReader ¶
type FileFormReader struct {
// contains filtered or unexported fields
}
type FixedBackoffPolicy ¶
type FixedBackoffPolicy struct {
Period int
}
FixedBackoffPolicy implementation
func NewFixedBackoffPolicy ¶
func NewFixedBackoffPolicy(option map[string]interface{}) *FixedBackoffPolicy
func (*FixedBackoffPolicy) GetDelayTime ¶
func (f *FixedBackoffPolicy) GetDelayTime(ctx *RetryPolicyContext) int
type FullJitterBackoffPolicy ¶
FullJitterBackoffPolicy implementation
func NewFullJitterBackoffPolicy ¶
func NewFullJitterBackoffPolicy(option map[string]interface{}) *FullJitterBackoffPolicy
func (*FullJitterBackoffPolicy) GetDelayTime ¶
func (f *FullJitterBackoffPolicy) GetDelayTime(ctx *RetryPolicyContext) int
type HttpClient ¶ added in v1.3.6
type HttpRequest ¶ added in v1.3.6
type HttpRequest interface { }
type HttpResponse ¶ added in v1.3.6
type HttpResponse interface { }
type Number ¶
type Number interface{}
Number is an interface that can be implemented by any numeric type
type RandomBackoffPolicy ¶
RandomBackoffPolicy implementation
func NewRandomBackoffPolicy ¶
func NewRandomBackoffPolicy(option map[string]interface{}) *RandomBackoffPolicy
func (*RandomBackoffPolicy) GetDelayTime ¶
func (r *RandomBackoffPolicy) GetDelayTime(ctx *RetryPolicyContext) int
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, runtimeObject *RuntimeObject) (response *Response, err error)
DoRequest is used send request to server
func NewResponse ¶
NewResponse is create response with http response
type ResponseError ¶
type RetryCondition ¶
type RetryCondition struct { MaxAttempts int Backoff BackoffPolicy Exception []string ErrorCode []string MaxDelay int }
RetryCondition holds the retry conditions
func NewRetryCondition ¶
func NewRetryCondition(condition map[string]interface{}) *RetryCondition
type RetryOptions ¶
type RetryOptions struct { Retryable bool RetryCondition []*RetryCondition NoRetryCondition []*RetryCondition }
RetryOptions holds the retry options
func NewRetryOptions ¶
func NewRetryOptions(options map[string]interface{}) *RetryOptions
type RetryPolicyContext ¶
type RetryPolicyContext struct { Key string RetriesAttempted int HttpRequest *Request // placeholder for actual http.Request type HttpResponse *Response // placeholder for actual http.Response type Exception error }
RetryPolicyContext holds context for the retry operation
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"` Key *string `json:"key" xml:"key"` Cert *string `json:"cert" xml:"cert"` Ca *string `json:"ca" xml:"ca"` Socks5Proxy *string `json:"socks5Proxy" xml:"socks5Proxy"` Socks5NetWork *string `json:"socks5NetWork" xml:"socks5NetWork"` Listener utils.ProgressListener `json:"listener" xml:"listener"` Tracker *utils.ReaderTracker `json:"tracker" xml:"tracker"` Logger *utils.Logger `json:"logger" xml:"logger"` RetryOptions *RetryOptions `json:"retryOptions" xml:"retryOptions"` ExtendsParameters *ExtendsParameters `json:"extendsParameters,omitempty" xml:"extendsParameters,omitempty"` HttpClient }
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 RuntimeOptions ¶
type RuntimeOptions = util.RuntimeOptions
type SDKError ¶
type SDKError struct { BaseError Code *string Name *string StatusCode *int Message *string Data *string Stack *string Description *string AccessDeniedDetail map[string]interface{} // contains filtered or unexported fields }
SDKError struct is used save error code and message
func NewSDKError ¶
NewSDKError is used for shortly create SDKError object