Documentation
¶
Index ¶
- func Decode(r io.Reader, v interface{}) error
- func NewRequestID(ctx context.Context) context.Context
- func RequestID(ctx context.Context) string
- func WithAddr(addr string) func(*API)
- func WithCORS(origins []string, methods []string, headers []string) func(*API)
- func WithTracing() func(*API)
- func WriteBadRequest(w http.ResponseWriter, msg string) error
- func WriteForbidden(w http.ResponseWriter, msg string) error
- func WriteInternal(w http.ResponseWriter, msg string) error
- func WriteNotAuthorized(w http.ResponseWriter, msg string) error
- func WriteNotFound(w http.ResponseWriter, msg string) error
- type API
- type Error
- func BadRequest(err string, args ...interface{}) *Error
- func Forbidden(err string, args ...interface{}) *Error
- func Internal(err string, args ...interface{}) *Error
- func NewError(code int, msg string, args ...interface{}) *Error
- func NotAuthorized(err string, args ...interface{}) *Error
- func NotFound(err string, args ...interface{}) *Error
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithTracing ¶
func WithTracing() func(*API)
func WriteBadRequest ¶
func WriteBadRequest(w http.ResponseWriter, msg string) error
func WriteForbidden ¶
func WriteForbidden(w http.ResponseWriter, msg string) error
func WriteInternal ¶
func WriteInternal(w http.ResponseWriter, msg string) error
func WriteNotAuthorized ¶
func WriteNotAuthorized(w http.ResponseWriter, msg string) error
func WriteNotFound ¶
func WriteNotFound(w http.ResponseWriter, msg string) error
Types ¶
type Error ¶
type Error struct { StatusCode int `json:"code"` Status error `json:"error"` Msg string `json:"message"` }
func BadRequest ¶
func NotAuthorized ¶
func (*Error) WithMessage ¶
Click to show internal directories.
Click to hide internal directories.