response

package
v0.5.25 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: GPL-3.0 Imports: 4 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

func NewFieldErrorsBodyData added in v0.5.21

func NewFieldErrorsBodyData(
	fieldErrors ...FieldError,
) *map[string]*[]string

NewFieldErrorsBodyData creates a new field errors body data

Types

type FieldError added in v0.5.22

type FieldError struct {
	Field string
	Err   string
}

FieldError struct

func NewFieldError added in v0.5.22

func NewFieldError(
	field, err string,
) *FieldError

NewFieldError creates a new field error

func (*FieldError) Error added in v0.5.24

func (f *FieldError) Error() string

Error returns the field error as a string

type JSendBody added in v0.5.17

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

JSendBody struct

func NewJSendErrorBody added in v0.5.17

func NewJSendErrorBody(
	message string,
	data interface{},
	code *int,
) *JSendBody

NewJSendErrorBody creates a new error response body

func NewJSendFailBody added in v0.5.17

func NewJSendFailBody(
	data interface{},
	code *int,
) *JSendBody

NewJSendFailBody creates a new fail response body

func NewJSendSuccessBody added in v0.5.17

func NewJSendSuccessBody(
	data interface{},
) *JSendBody

NewJSendSuccessBody creates a new success response body

type Response added in v0.3.0

type Response struct {
	// contains filtered or unexported fields
}

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

func (*Response) GetBody added in v0.5.17

func (r *Response) GetBody(mode *goflagsmode.Flag) interface{}

GetBody returns the response body

func (*Response) GetHTTPStatus added in v0.5.17

func (r *Response) GetHTTPStatus() int

GetHTTPStatus returns the HTTP status

Jump to

Keyboard shortcuts

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