encoder

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptType

type AcceptType = string
const (
	ApplicationJSON AcceptType = "application/json"
	ApplicationXML  AcceptType = "application/xml"
	TextXML         AcceptType = "text/xml"
)

type Encoder

type Encoder interface {
	Encode(data interface{}) ([]byte, error)
	Decode(data []byte, dst interface{}) error
	GetMime() string
}

func NewJSON

func NewJSON() Encoder

func NewXML

func NewXML() Encoder

type Factory

type Factory interface {
	CreateFromResponse(resp *http.Response) Encoder
	CreateFromRequest(req *http.Request) Encoder
	FromMime(mediaType string) Encoder
}

func NewFactory

func NewFactory() Factory

type FactoryMock

type FactoryMock struct {
	mock.Mock
}

func (*FactoryMock) CreateFromRequest

func (f *FactoryMock) CreateFromRequest(req *http.Request) Encoder

func (*FactoryMock) CreateFromResponse

func (f *FactoryMock) CreateFromResponse(resp *http.Response) Encoder

func (*FactoryMock) FromMime

func (f *FactoryMock) FromMime(mediaType string) Encoder

type Mock

type Mock struct {
	mock.Mock
}

func (*Mock) Decode

func (e *Mock) Decode(data []byte, dst interface{}) error

func (*Mock) Encode

func (e *Mock) Encode(data interface{}) ([]byte, error)

func (*Mock) GetMime

func (e *Mock) GetMime() string

Jump to

Keyboard shortcuts

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