Documentation ¶
Overview ¶
Code generated by go generate; DO NOT EDIT.
Index ¶
- func CustomHeaders(inner http.Handler) http.Handler
- func GenerateCustom(seed int64, template string, count int32) []string
- func GenerateUsers(seed int64, count int, deterministic bool) ([]*models.User, int64, error)
- func Gzip(inner http.Handler) http.Handler
- type MyHandlers
- func (h *MyHandlers) GetCustomCountParams(params operations.GetCustomCountParams, principal interface{}) middleware.Responder
- func (*MyHandlers) GetHealthHandler(params operations.GetHealthParams, principal interface{}) middleware.Responder
- func (h *MyHandlers) GetUsersHandler(params operations.GetUsersCountParams, principal interface{}) (result middleware.Responder)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CustomHeaders ¶
CustomHeaders adds cache and basic HTTP headers to response
func GenerateCustom ¶
GenerateCustom will replace all known ~keys~ from the template with random data, based on the seed. The result will contain (count) such strings. For each unique seed/template/count group the result should be the same (deterministic).
Example ¶
template := "Hello ~name~!" seed := 42 //for each seed value will generate a different result count := 2 randomData := GenerateCustom(int64(seed), template, int32(count)) for _, result := range randomData { fmt.Printf("%s\n", result) }
Output: Hello Jeromy Schmeler! Hello Kim Steuber!
func GenerateUsers ¶
GenerateUsers deterministic generation of (random) users.
Types ¶
type MyHandlers ¶
type MyHandlers struct {
Api *operations.PseudoServiceAPI
}
MyHandlers we need this struct to inject dependencies and access them from handlers like logger.
func (*MyHandlers) GetCustomCountParams ¶
func (h *MyHandlers) GetCustomCountParams(params operations.GetCustomCountParams, principal interface{}) middleware.Responder
GetCustomCountParams sanitize the HTTP input and add the GenerateCustom result to the HTTP response.
func (*MyHandlers) GetHealthHandler ¶
func (*MyHandlers) GetHealthHandler(params operations.GetHealthParams, principal interface{}) middleware.Responder
GetHealthHandler basic /health checks for math.rand entropy
func (*MyHandlers) GetUsersHandler ¶
func (h *MyHandlers) GetUsersHandler(params operations.GetUsersCountParams, principal interface{}) (result middleware.Responder)
GetUsersHandler /users/{count} handler with real data