Documentation
¶
Index ¶
Constants ¶
View Source
const ( CONTENT_TYPE_JSON string = "application/json; charset=utf-8" CONTENT_TYPE_TEXT string = "text/plain; charset=utf-8" )
View Source
const ( JSON = JSONFormatter("") Text = TextFormatter("") )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentFormatter ¶
type ContentFormatter interface {
Success(w http.ResponseWriter, body any) error
Failure(w http.ResponseWriter, body any, statusCode int) error
}
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a wrapped error with custom message. Implements error interface and provides unwrapping capability.
func WrapError ¶
WrapError wraps an existing error with additional message context. If message is empty, uses the original error's message.
type JSONFormatter ¶
type JSONFormatter string
func (JSONFormatter) Failure ¶
func (f JSONFormatter) Failure(w http.ResponseWriter, body any, statusCode int) error
func (JSONFormatter) Success ¶
func (f JSONFormatter) Success(w http.ResponseWriter, body any) error
type TextFormatter ¶
type TextFormatter string
func (TextFormatter) Failure ¶
func (f TextFormatter) Failure(w http.ResponseWriter, body any, statusCode int) error
func (TextFormatter) Success ¶
func (f TextFormatter) Success(w http.ResponseWriter, body any) error
Click to show internal directories.
Click to hide internal directories.