Documentation
¶
Index ¶
- func AllowAllCorsMiddleware(h http.Handler) http.Handler
- func ProcessHTTPError(err error, w http.ResponseWriter, _ *http.Request)
- type AppHandler
- type AppHandlerWithUserID
- type GelfFormatter
- type ServerErrorData
- type ServerErrorLoginRequired
- type ServerErrorWithText
- type ServerStatus
- type SimpleService
- type SimpleServiceBase
- type SimpleServiceBeforeEnd
- type SimpleServiceBeforeStart
- type SimpleServiceGetHTTPHandler
- type SimpleServiceObject
- type SimpleServicePreparePFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllowAllCorsMiddleware ¶
AllowAllCorsMiddleware returns middleware function that can be used in router.Use()
func ProcessHTTPError ¶
func ProcessHTTPError(err error, w http.ResponseWriter, _ *http.Request)
ProcessHTTPError writes formated error response to w
Types ¶
type AppHandler ¶
type AppHandler func(w http.ResponseWriter, r *http.Request) error
AppHandler is handler that take care of content type and error handling
func (AppHandler) ServeHTTP ¶
func (ah AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Satisfies the http.Handler interface
type AppHandlerWithUserID ¶
AppHandlerWithUserID is handler that take care of userID, content type and error handling
func (AppHandlerWithUserID) ServeHTTP ¶
func (ah AppHandlerWithUserID) ServeHTTP(w http.ResponseWriter, r *http.Request)
Satisfies the http.Handler interface
type GelfFormatter ¶
type GelfFormatter struct {
// contains filtered or unexported fields
}
GelfFormatter ...
type ServerErrorData ¶
type ServerErrorData struct { Parent error `json:"-"` Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Description string `json:"description,omitempty"` Stack string `json:"-"` }
ServerErrorData is custom error that should be used to describe better errors
func ServerError ¶
func ServerError(Parent error, Code int, Message string) *ServerErrorData
ServerError Create error object
func (*ServerErrorData) Error ¶
func (e *ServerErrorData) Error() string
type ServerErrorLoginRequired ¶
type ServerErrorLoginRequired struct { *ServerErrorData LoginRequired bool `json:"login_required,omitempty"` }
ServerErrorLoginRequired is server error that can provide info if login is required
type ServerErrorWithText ¶
type ServerErrorWithText struct { *ServerErrorData ErrorText string `json:"error,omitempty"` }
ServerErrorWithText extra text
type ServerStatus ¶
type ServerStatus struct { Running bool `json:"running"` // Name string `json:"name"` Process string `json:"process"` Pid int `json:"pid"` }
ServerStatus return actual state and process data so you can test with url/state the correct installation of microservice
func NewServerStatus ¶
func NewServerStatus() *ServerStatus
NewServerStatus create default service status
type SimpleService ¶
type SimpleService interface { Start() (err error) // Start service SetTimeouts(writeTimeout time.Duration, readTimeout time.Duration, idleTimeout time.Duration) // set timeouts. 0 will use default values. It must be called before start }
SimpleService ...
func NewSimpleService ¶
func NewSimpleService(obj SimpleServiceObject) SimpleService
NewSimpleService creates new simple service object
type SimpleServiceBase ¶
type SimpleServiceBase struct {
// contains filtered or unexported fields
}
SimpleServiceBase ...
func (*SimpleServiceBase) SetTimeouts ¶ added in v0.2.1
func (*SimpleServiceBase) Start ¶
func (s *SimpleServiceBase) Start() (err error)
Start starts service
type SimpleServiceBeforeEnd ¶ added in v0.2.2
type SimpleServiceBeforeEnd interface {
BeforeEnd()
}
SimpleServiceBeforeEnd ...
type SimpleServiceBeforeStart ¶
type SimpleServiceBeforeStart interface {
BeforeStart() (err error)
}
SimpleServiceBeforeStart ...
type SimpleServiceGetHTTPHandler ¶
SimpleServiceGetHTTPHandler ...
type SimpleServicePreparePFlags ¶
type SimpleServicePreparePFlags interface {
PreparePFlags() (err error)
}
SimpleServicePreparePFlags ...
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
custom-routes
command
|
|
dummy
command
|
|
input-params
command
|
|
timeouts
command
|
|