response

package
v0.5.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusNone = 0
)

Variables

View Source
var (
	ErrNilResponse           = errors.New("response cannot be nil")
	ErrNilResponseHTTPStatus = errors.New("response http status cannot be nil")
)

Functions

This section is empty.

Types

type JSendResponse added in v0.5.0

type JSendResponse struct {
	Status  string      `json:"status"`
	Data    interface{} `json:"data"`
	Message *string     `json:"message,omitempty"`
	Code    *int        `json:"code,omitempty"`
}

JSendResponse struct

func NewJSendErrorResponse added in v0.5.0

func NewJSendErrorResponse(
	message string,
	data interface{},
	code *int,
) *JSendResponse

NewJSendErrorResponse creates a new error response

func NewJSendFailResponse added in v0.5.0

func NewJSendFailResponse(
	data interface{},
	code *int,
) *JSendResponse

NewJSendFailResponse creates a new fail response

func NewJSendSuccessResponse added in v0.5.0

func NewJSendSuccessResponse(
	data interface{},
) *JSendResponse

NewJSendSuccessResponse creates a new success response

type Response added in v0.3.0

type Response struct {
	Response      interface{}
	DebugResponse interface{}
	HTTPStatus    int
}

Response struct

func NewDebugErrorResponse added in v0.4.6

func NewDebugErrorResponse(
	err error,
	debugErr error,
	data interface{},
	errorCode *int,
	httpStatus int,
) *Response

NewDebugErrorResponse creates a new error response

func NewDebugFailResponse added in v0.5.0

func NewDebugFailResponse(
	data interface{},
	debugData interface{},
	errorCode *int,
	httpStatus int,
) *Response

NewDebugFailResponse creates a new fail response

func NewDebugSuccessResponse added in v0.5.0

func NewDebugSuccessResponse(
	data interface{},
	debugData interface{},
	httpStatus int,
) *Response

NewDebugSuccessResponse creates a new success response

func NewErrorResponse

func NewErrorResponse(
	err error,
	data interface{},
	errorCode *int,
	httpStatus int,
) *Response

NewErrorResponse creates a new error response

func NewFailResponse added in v0.5.0

func NewFailResponse(
	data interface{},
	errorCode *int,
	httpStatus int,
) *Response

NewFailResponse creates a new fail response

func NewSuccessResponse added in v0.5.0

func NewSuccessResponse(
	data interface{},
	httpStatus int,
) *Response

NewSuccessResponse creates a new success response

Jump to

Keyboard shortcuts

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