Documentation ¶
Overview ¶
Package rkmidmeta is a middleware for metadata
Index ¶
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 Request *http.Request Event rkquery.Event } Output struct { RequestId string HeadersToReturn map[string]string } }
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"` Prefix string `yaml:"prefix" json:"prefix"` Ignore []string `yaml:"ignore" json:"ignore"` }
BootConfig for YAML
type Option ¶
type Option func(*optionSet)
Option if for middleware options while creating middleware
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.
type OptionSetInterface ¶
type OptionSetInterface interface { GetEntryName() string GetEntryType() string Before(*BeforeCtx) BeforeCtx(*http.Request, rkquery.Event) *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
Click to show internal directories.
Click to hide internal directories.