handlers

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomHeaders

func CustomHeaders(inner http.Handler) http.Handler

CustomHeaders adds cache and basic HTTP headers to response

func GenerateCustom

func GenerateCustom(seed int64, template string, count int32) []string

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

func GenerateUsers(seed int64, count int, deterministic bool) ([]*models.User, int64, error)

GenerateUsers deterministic generation of (random) users.

func Gzip

func Gzip(inner http.Handler) http.Handler

Gzip add a simple gzip functionality if the clients accepts it

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL