Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallWrapper ¶
type CallWrapper struct {
// contains filtered or unexported fields
}
CallWrapper is the wrapper for the call function.
type Hook ¶
type Hook struct {
// Hook that is called when success execution
BeforeHook func(ctx context.Context) map[string]interface{}
// Hook that is called when success execution
AfterHook func(ctx context.Context, param map[string]interface{})
// OnErrorLog is the hook that is called when error occurs
OnErrorLog func(ctx context.Context, msg string, err error)
// OnWarnLog is the hook that is called when error occurs but still tolerable.
OnWarnLog func(ctx context.Context, msg string, err error)
}
type Interface ¶
type Interface interface {
Call(ctx context.Context, key map[string]interface{}, fn callFunc) (resp interface{}, err error)
}
Interface is the interface for the callwrapper.
func GetCallWrapper ¶
GetCallWrapper returns the callwrapper by name. Be careful when using this function. If the callwrapper is not found, it will return nil.
type Options ¶
type Options struct {
// Toggle for singleflight. Default is false.
// Singleflight help to prevent multiple call to the same function.
Singleflight bool
// CacheExpiration is the expiration time for the cache. Default is 5 minutes.
CacheExpiration time.Duration
// Cache wll improve perfomance. But if you need realtime data response, set ths value to false
Cache bool
// CacheClient is the client for the cache.
CacheClient cache.Client
// Hook is the configuration for the hook.
Hook Hook
}
Options is the configuration for the callwrapper
Click to show internal directories.
Click to hide internal directories.