Documentation
¶
Overview ¶
Package rkmidtimeout provide options
Index ¶
- type BeforeCtx
- type BootConfig
- type Option
- func ToOptions(config *BootConfig, entryName, entryType string) []Option
- func WithEntryNameAndType(entryName, entryType string) Option
- func WithMockOptionSet(mock OptionSetInterface) Option
- func WithPathToIgnore(paths ...string) Option
- func WithTimeout(timeout time.Duration) Option
- func WithTimeoutByPath(path string, timeout time.Duration) Option
- type OptionSetInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeforeCtx ¶
type BeforeCtx struct { Input struct { UrlPath string InitHandler func() NextHandler func() PanicHandler func() FinishHandler func() TimeoutHandler func() Event rkquery.Event } Output struct { WaitFunc func() TimeoutErrResp rkerror.ErrorInterface } }
BeforeCtx context for Before() function
func NewBeforeCtx ¶
func NewBeforeCtx() *BeforeCtx
NewBeforeCtx create new BeforeCtx with fields initialized
type BootConfig ¶
type BootConfig struct { Enabled bool `yaml:"enabled" json:"enabled"` TimeoutMs int `yaml:"timeoutMs" json:"timeoutMs"` Ignore []string `yaml:"ignore" json:"ignore"` Paths []struct { Path string `yaml:"path" json:"path"` TimeoutMs int `yaml:"timeoutMs" json:"timeoutMs"` } `yaml:"paths" json:"paths"` }
BootConfig for YAML
type Option ¶
type Option func(*optionSet)
Option options provided to Interceptor or optionsSet while creating
func ToOptions ¶
func ToOptions(config *BootConfig, entryName, entryType string) []Option
ToOptions convert BootConfig into Option list
func WithEntryNameAndType ¶
WithEntryNameAndType provide entry name and entry type.
func WithMockOptionSet ¶
func WithMockOptionSet(mock OptionSetInterface) Option
WithMockOptionSet provide mock OptionSetInterface
func WithPathToIgnore ¶
WithPathToIgnore provide paths prefix that will ignore.
func WithTimeout ¶
WithTimeout Provide global timeout and response handler. If response is nil, default globalResponse will be assigned
type OptionSetInterface ¶
type OptionSetInterface interface { GetEntryName() string GetEntryType() string BeforeCtx(*http.Request, rkquery.Event) *BeforeCtx Before(*BeforeCtx) ShouldIgnore(string) bool }
OptionSetInterface mainly for testing purpose
func NewOptionSet ¶
func NewOptionSet(opts ...Option) OptionSetInterface
NewOptionSet Create new optionSet with options.
func NewOptionSetMock ¶
func NewOptionSetMock(before *BeforeCtx) OptionSetInterface
NewOptionSetMock for testing purpose