handlers

package
v0.0.0-...-b56f772 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BAD_REQUEST = ".bad_request"
View Source
const CALLED = ".called"
View Source
const ECHO_HANDLER = "helloworld.echo_handler"
View Source
const EHTAGNAME = "EchoHandler: "
View Source
const GET = ".get"
View Source
const HEALTH_HANDLER = "helloworld.health_handler"
View Source
const HHTAGNAME = "HealthHandler: "
View Source
const INVALID_REQUEST = ".invalid_request"
View Source
const POST = ".post"
View Source
const SUCCESS = ".success"
View Source
const VALID_REQUEST = ".valid_request"

Variables

This section is empty.

Functions

func EchoHandler

func EchoHandler(rw http.ResponseWriter, r *http.Request)

func GetRouter

func GetRouter() *pat.Router

func HealthHandler

func HealthHandler(rw http.ResponseWriter, r *http.Request)

Types

type Echo

type Echo struct {
	Echo string `json:"echo" valid:"stringlength(1|255),required"`
}

use the validation middleware to automatically validate input github.com/asaskevich/govalidator

type EchoDependenciesContainer

type EchoDependenciesContainer struct {
	StatsD logging.StatsD `inject:"statsd"`
	Log    *log.Logger    `inject:""`
}

type HealthDependenciesContainer

type HealthDependenciesContainer struct {
	// if not specified will create singleton
	SingletonBuilder *HealthResponseBuilder `inject:""`

	// statsD interface must use a name type as injection cannot infer ducktypes
	Stats logging.StatsD `inject:"statsd"`

	// reference to the log writer
	Log *log.Logger `inject:""`

	// if not specified in the graph will automatically create private instance
	PrivateBuilder *HealthResponseBuilder `inject:"private"`
}

type HealthResponse

type HealthResponse struct {
	StatusMessage string `json:"status_message"`
}

type HealthResponseBuilder

type HealthResponseBuilder struct {
	// contains filtered or unexported fields
}

This is not particularlly a real world example it mearly shows how a builder or a factory could be injected into the HealthHandler

func (*HealthResponseBuilder) Build

func (*HealthResponseBuilder) SetStatusMessage

func (b *HealthResponseBuilder) SetStatusMessage(message string) *HealthResponseBuilder

type RouterDependenciesContainer

type RouterDependenciesContainer struct {
	StatsD logging.StatsD `inject:"statsd"`
}

Jump to

Keyboard shortcuts

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