response

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendResponseToContext added in v1.1.0

func AppendResponseToContext(ctx context.Context, r *Response) context.Context

func Decode

func Decode(value []byte, out any) error

Decode is a helper function that translates a byte slice into a target by converting its type.

func SetResponseCode added in v1.1.0

func SetResponseCode(ctx context.Context, code int)

func Zero

func Zero(value interface{})

Zero clears the value of the argument to its zero value according its type.

Types

type Field

type Field struct {
	Field    string `json:"field,omitempty"`
	Message  string `json:"message,omitempty"`
	Location string `json:"location,omitempty"`
}

type Options

type Options struct {
	ServiceName string
}

type Response

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

func NewFromEcho added in v1.1.0

func NewFromEcho(ctx echo.Context, options *Options) *Response

func NewFromFasthttp added in v1.1.0

func NewFromFasthttp(ctx *fasthttp.RequestCtx, options *Options) *Response

NewFromFasthttp creates a new response container for HTTP handlers return data using a specific standard.

func RetrieveFromContext added in v1.1.0

func RetrieveFromContext(ctx context.Context) *Response

func (*Response) ForwardAuthenticationError

func (r *Response) ForwardAuthenticationError(err error) error

func (*Response) ForwardError

func (r *Response) ForwardError(err error) error

func (*Response) ForwardSuccess

func (r *Response) ForwardSuccess(data interface{}) error

func (*Response) SetContentType

func (r *Response) SetContentType(contentType string)

type ResponserEcho added in v1.1.0

type ResponserEcho interface {
	HttpResponseBytes() ([]byte, error)
}

type ResponserFasthttp added in v1.1.0

type ResponserFasthttp interface {
	HttpResponse() interface{}
}

ResponserFasthttp is a behavior that a struct may have to format its fields in case of an HTTP response.

Jump to

Keyboard shortcuts

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