response

package
v0.4.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilResponse     = errors.New("response cannot be nil")
	ErrNilResponseCode = errors.New("response code cannot be nil")
)

Functions

This section is empty.

Types

type JSONErrorResponse added in v0.3.0

type JSONErrorResponse struct {
	Error string `json:"error"`
}

JSONErrorResponse struct

func NewJSONErrorResponse added in v0.3.0

func NewJSONErrorResponse(err error) *JSONErrorResponse

NewJSONErrorResponse creates a new error response

func NewJSONErrorResponseFromString added in v0.4.10

func NewJSONErrorResponseFromString(err string) *JSONErrorResponse

NewJSONErrorResponseFromString creates a new error response from a string

type JSONValidationErrorResponse added in v0.4.13

type JSONValidationErrorResponse struct {
	Message string      `json:"message"`
	Error   interface{} `json:"error"`
}

JSONValidationErrorResponse struct

func NewJSONValidationErrorResponse added in v0.4.13

func NewJSONValidationErrorResponse(
	err interface{},
	message string,
) *JSONValidationErrorResponse

NewJSONValidationErrorResponse creates a new validation error response

type Response added in v0.3.0

type Response struct {
	Data      interface{}
	DebugData interface{}
	Code      *int
}

Response struct

func NewDebugErrorResponse added in v0.4.6

func NewDebugErrorResponse(err error, debugErr error) *Response

NewDebugErrorResponse creates a new error response

func NewDebugErrorResponseWithCode added in v0.4.6

func NewDebugErrorResponseWithCode(
	err error,
	debugErr error,
	code int,
) *Response

NewDebugErrorResponseWithCode creates a new error response with a code

func NewDebugResponse added in v0.4.6

func NewDebugResponse(data interface{}, debugData interface{}) *Response

NewDebugResponse creates a new response

func NewDebugResponseWithCode added in v0.4.6

func NewDebugResponseWithCode(
	data interface{},
	debugData interface{},
	code int,
) *Response

NewDebugResponseWithCode creates a new response with a code

func NewErrorResponse

func NewErrorResponse(err error) *Response

NewErrorResponse creates a new error response

func NewErrorResponseWithCode added in v0.3.0

func NewErrorResponseWithCode(err error, code int) *Response

NewErrorResponseWithCode creates a new error response with a code

func NewResponse added in v0.3.0

func NewResponse(data interface{}) *Response

NewResponse creates a new response

func NewResponseWithCode added in v0.3.0

func NewResponseWithCode(data interface{}, code int) *Response

NewResponseWithCode creates a new response with a code

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL