Documentation
¶
Index ¶
Constants ¶
View Source
const ( ValidationErrCode = 101 InternalServerErrCode = 500 )
View Source
const (
UnknownErrCode = 400
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONAPI ¶
func (JSONAPI) WriteContentType ¶
func (j JSONAPI) WriteContentType(w http.ResponseWriter)
type JSONAPIErrors ¶
type JSONAPIErrors struct {
Errors []*jsonapi.ErrorObject
// contains filtered or unexported fields
}
func NewJSONAPIErrors ¶
func NewJSONAPIErrors() *JSONAPIErrors
func (*JSONAPIErrors) AddError ¶
func (e *JSONAPIErrors) AddError(err error) *JSONAPIErrors
func (*JSONAPIErrors) AddErrors ¶
func (e *JSONAPIErrors) AddErrors(errs []error) *JSONAPIErrors
func (*JSONAPIErrors) GetHTTPStatus ¶
func (e *JSONAPIErrors) GetHTTPStatus() int
func (*JSONAPIErrors) Render ¶
func (e *JSONAPIErrors) Render(w http.ResponseWriter) error
func (*JSONAPIErrors) WriteContentType ¶
func (e *JSONAPIErrors) WriteContentType(w http.ResponseWriter)
type Response ¶
type Response struct {
Status string `json:"status"`
ErrorCode int `json:"error_code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
func NewResponseWithError ¶
func NewSuccessResponse ¶
func (Response) WriteContentType ¶
func (r Response) WriteContentType(w http.ResponseWriter)
Click to show internal directories.
Click to hide internal directories.