response

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLoadBytesJoiner = &SResponseError{"load bytes joiner"}
	ErrDecodeResponse  = &SResponseError{"decode response"}
	ErrUnknownType     = &SResponseError{"unknown type"}
)

Functions

This section is empty.

Types

type IResponse

type IResponse interface {
	types.IConverter

	GetCode() int
	GetHead() map[string]string
	GetBody() []byte
}

func LoadResponse

func LoadResponse(pData interface{}) (IResponse, error)

type IResponseBuilder added in v1.7.7

type IResponseBuilder interface {
	Build() IResponse

	WithCode(pCode int) IResponseBuilder
	WithHead(map[string]string) IResponseBuilder
	WithBody(pBody []byte) IResponseBuilder
}

func NewResponseBuilder added in v1.7.7

func NewResponseBuilder() IResponseBuilder

type SResponse

type SResponse struct {
	SResponseBlock
	FBody []byte `json:"body,omitempty"`
}

func (*SResponse) Build added in v1.7.7

func (p *SResponse) Build() IResponse

func (*SResponse) GetBody

func (p *SResponse) GetBody() []byte

func (*SResponse) GetCode

func (p *SResponse) GetCode() int

func (*SResponse) GetHead

func (p *SResponse) GetHead() map[string]string

func (*SResponse) ToBytes

func (p *SResponse) ToBytes() []byte

func (*SResponse) ToString

func (p *SResponse) ToString() string

func (*SResponse) WithBody

func (p *SResponse) WithBody(pBody []byte) IResponseBuilder

func (*SResponse) WithCode

func (p *SResponse) WithCode(pCode int) IResponseBuilder

func (*SResponse) WithHead

func (p *SResponse) WithHead(pHead map[string]string) IResponseBuilder

type SResponseBlock

type SResponseBlock struct {
	FCode int               `json:"code,omitempty"`
	FHead map[string]string `json:"head,omitempty"`
}

type SResponseError

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

func (*SResponseError) Error

func (err *SResponseError) Error() string

Jump to

Keyboard shortcuts

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