Documentation ¶
Index ¶
- Constants
- func EchoHandler(rw http.ResponseWriter, r *http.Request)
- func GetRouter() *pat.Router
- func HealthHandler(rw http.ResponseWriter, r *http.Request)
- type Echo
- type EchoDependenciesContainer
- type HealthDependenciesContainer
- type HealthResponse
- type HealthResponseBuilder
- type RouterDependenciesContainer
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 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:""` }
var EchoDependencies *EchoDependenciesContainer = &EchoDependenciesContainer{}
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"` }
var HealthDependencies *HealthDependenciesContainer = &HealthDependenciesContainer{}
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 (b *HealthResponseBuilder) Build() HealthResponse
func (*HealthResponseBuilder) SetStatusMessage ¶
func (b *HealthResponseBuilder) SetStatusMessage(message string) *HealthResponseBuilder
type RouterDependenciesContainer ¶
var RouterDependencies *RouterDependenciesContainer = &RouterDependenciesContainer{}
Click to show internal directories.
Click to hide internal directories.