Documentation ¶
Index ¶
- func GetErrorType(err interface{}) string
- type BatchPostHandler
- type BatchPreHandler
- type Handle
- func (h *Handle) Invoke(ctx context.Context, payload json.RawMessage) (result interface{}, err error)
- func (h *Handle) OnPanicHandler(panicHandler PanicHandler)
- func (h *Handle) OnRetryFailedHandler(retryFailedHandler RetryFailedHandler)
- func (h *Handle) RegisterBatchPostHandler(batchPostHandlers ...BatchPostHandler)
- func (h *Handle) RegisterBatchPreHandler(batchPreHandlers ...BatchPreHandler)
- func (h *Handle) RegisterPostHandler(postHandlers ...PostHandler)
- func (h *Handle) RegisterPreHandler(preHandlers ...PreHandler)
- func (h *Handle) Run(ctx context.Context, payload json.RawMessage, src interface{}, isBatch bool) (interface{}, error)
- func (h *Handle) SetRetry(times int)
- type Handler
- type PanicHandler
- type PostHandler
- type PreHandler
- type Retries
- type RetryFailedHandler
- type SourceList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetErrorType ¶
func GetErrorType(err interface{}) string
import (
"reflect"
)
type lambdaError struct { ErrorMessage string `json:"errorMessage"` ErrorType string `json:"errorType"` }
func NewLambdaErrorFrom(err error) *lambdaError { switch e := err.(type) { case errors.Error: return &lambdaError{ ErrorMessage: e.Error(), ErrorType: e.GetCode(), } } return &lambdaError{ ErrorType: GetErrorType(err), ErrorMessage: err.Error(), } }
func (e *lambdaError) GetCode() string { return e.ErrorType }
func (e *lambdaError) Error() string { return e.ErrorMessage }
Types ¶
type BatchPostHandler ¶
type BatchPreHandler ¶
type BatchPreHandler func(ctx context.Context, payload json.RawMessage, src interface{}) (interface{}, error)
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) OnPanicHandler ¶ added in v1.0.2
func (h *Handle) OnPanicHandler(panicHandler PanicHandler)
func (*Handle) OnRetryFailedHandler ¶ added in v1.0.2
func (h *Handle) OnRetryFailedHandler(retryFailedHandler RetryFailedHandler)
func (*Handle) RegisterBatchPostHandler ¶ added in v1.0.2
func (h *Handle) RegisterBatchPostHandler(batchPostHandlers ...BatchPostHandler)
func (*Handle) RegisterBatchPreHandler ¶ added in v1.0.2
func (h *Handle) RegisterBatchPreHandler(batchPreHandlers ...BatchPreHandler)
func (*Handle) RegisterPostHandler ¶ added in v1.0.2
func (h *Handle) RegisterPostHandler(postHandlers ...PostHandler)
func (*Handle) RegisterPreHandler ¶ added in v1.0.2
func (h *Handle) RegisterPreHandler(preHandlers ...PreHandler)
type Handler ¶ added in v1.0.1
type Handler interface { ParseSource(ctx context.Context, payload json.RawMessage) interface{} ParseSources(ctx context.Context, payload json.RawMessage) interface{} Handler(ctx context.Context, source interface{}) (interface{}, error) BatchHandler(ctx context.Context, sources interface{}) (interface{}, error) }
type PanicHandler ¶
type PostHandler ¶
type PreHandler ¶
type PreHandler func(ctx context.Context, payload json.RawMessage, src interface{}) (interface{}, error)
type RetryFailedHandler ¶
type SourceList ¶
type SourceList interface{}
Click to show internal directories.
Click to hide internal directories.