Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type All ¶
type All struct {
Endpoints []Endpoint `yaml:"endpoints"`
}
All stores all the information of the configuration file
type DeleteEndpoint ¶
type DeleteEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
DeleteEndpoint implements the EndpointGenerator interface
type Endpoint ¶
type Endpoint struct { Path string `yaml:"path"` Get *GetEndpoint `yaml:"get"` Post *PostEndpoint `yaml:"post"` Put *PutEndpoint `yaml:"put"` Patch *PatchEndpoint `yaml:"patch"` Delete *DeleteEndpoint `yaml:"delete"` Head *HeadEndpoint `yaml:"head"` Options *OptionsEndpoint `yaml:"options"` All []EndpointGenerator `yaml:"-"` }
Endpoint is a simple endpoint struct used to parse the configuration file
type EndpointGenerator ¶
EndpointGenerator is an interface that allows to generate endpoints
type GetEndpoint ¶
type GetEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
GetEndpoint implements the EndpointGenerator interface
type HeadEndpoint ¶
type HeadEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
HeadEndpoint implements the EndpointGenerator interface
type MethodEndpoint ¶
type MethodEndpoint struct { Preset string `yaml:"preset"` // random, ratio Responses []*Response `yaml:"responses"` Headers []string `yaml:"headers"` }
MethodEndpoint represents a single endpoint
func (*MethodEndpoint) CalcRatios ¶
func (e *MethodEndpoint) CalcRatios()
CalcRatios computes the ratios for every response that doesn't have one
func (MethodEndpoint) Info ¶ added in v1.1.0
func (e MethodEndpoint) Info(last bool) string
Info returns the string representing the info
func (MethodEndpoint) PickResponse ¶
func (e MethodEndpoint) PickResponse() *Response
PickResponse picks a random response according to the ratio defined in the responses
func (MethodEndpoint) ToHandler ¶
func (e MethodEndpoint) ToHandler() func(c *gin.Context)
ToHandler generates a handler to apply on the router
type OptionsEndpoint ¶
type OptionsEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
OptionsEndpoint implements the EndpointGenerator interface
type PatchEndpoint ¶
type PatchEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
PatchEndpoint implements the EndpointGenerator interface
type PostEndpoint ¶
type PostEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
PostEndpoint implements the EndpointGenerator interface
type PutEndpoint ¶
type PutEndpoint struct {
MethodEndpoint `yaml:",inline"`
}
PutEndpoint implements the EndpointGenerator interface