Documentation
¶
Index ¶
- func BadRequest(s string) error
- func BadRequestf(s string, args ...interface{}) error
- func Internal(s string) error
- func Internalf(s string, args ...interface{}) error
- func LoggerFromContext(ctx context.Context) *log.Entry
- func LoggerFromRequest(r *http.Request) *log.Entry
- func NotFound(s string) error
- func NotFoundf(s string, args ...interface{}) error
- func RequestFromContext(ctx context.Context) *http.Request
- func Unauthorized(s string) error
- func Unauthorizedf(s string, args ...interface{}) error
- type HTTPHandler
- type Server
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequestf ¶
BadRequestf returns a 400 HTTP error and formats its message.
func LoggerFromContext ¶
LoggerFromContext returns the logger from a context. The context must have been previously extracted from r.Context().
func LoggerFromRequest ¶
LoggerFromRequest returns the logger from an HTTP request.
func RequestFromContext ¶
RequestFromContext returns the HTTP request from a context. The context must have been previously extracted from r.Context().
func Unauthorizedf ¶
Unauthorizedf returns a 401 HTTP error and formats its message.
Types ¶
type HTTPHandler ¶
type HTTPHandler func(w http.ResponseWriter, r *http.Request) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) HTTPGet ¶
func (server *Server) HTTPGet(funcName string, handler HTTPHandler)
func (*Server) HTTPPost ¶
func (server *Server) HTTPPost(funcName string, handler HTTPHandler)
type ServerOption ¶
type ServerOption func(server *Server)
func WithDebug ¶
func WithDebug() ServerOption
func WithTrace ¶
func WithTrace() ServerOption
Click to show internal directories.
Click to hide internal directories.