encode

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("Encode:Unsupported type")

Functions

func Encode

func Encode(in interface{}, a Adder) error

in 的类型可以是 struct map []string

Types

type Adder

type Adder interface {
	Add(key string, v reflect.Value, sf reflect.StructField) error
	Name() string
}

type BodyEncode

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

func NewBodyEncode

func NewBodyEncode(obj interface{}) *BodyEncode

func (*BodyEncode) Encode

func (b *BodyEncode) Encode(w io.Writer) error

func (*BodyEncode) Name added in v0.0.3

func (b *BodyEncode) Name() string

type FormEncode

type FormEncode struct {
	*multipart.Writer
}

func NewFormEncode

func NewFormEncode(b *bytes.Buffer) *FormEncode

func (*FormEncode) Add

func (f *FormEncode) Add(key string, v reflect.Value, sf reflect.StructField) (err error)

func (*FormEncode) End

func (f *FormEncode) End() error

func (*FormEncode) Name

func (f *FormEncode) Name() string

type HeaderEncode

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

func NewHeaderEncode

func NewHeaderEncode(req *http.Request) *HeaderEncode

func (*HeaderEncode) Add

func (*HeaderEncode) Name

func (h *HeaderEncode) Name() string

type JSONEncode added in v0.0.2

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

func NewJSONEncode added in v0.0.2

func NewJSONEncode(obj interface{}) *JSONEncode

func (*JSONEncode) Encode added in v0.0.2

func (j *JSONEncode) Encode(w io.Writer) error

func (*JSONEncode) Name added in v0.0.3

func (j *JSONEncode) Name() string

type QueryEncode

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

func NewQueryEncode

func NewQueryEncode(req *http.Request) *QueryEncode

func (*QueryEncode) Add

func (*QueryEncode) End

func (q *QueryEncode) End() string

func (*QueryEncode) Name

func (q *QueryEncode) Name() string

type WWWFormEncode added in v0.0.3

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

func NewWWWFormEncode added in v0.0.3

func NewWWWFormEncode(obj interface{}) *WWWFormEncode

func (*WWWFormEncode) Add added in v0.0.3

func (*WWWFormEncode) Encode added in v0.0.3

func (we *WWWFormEncode) Encode(w io.Writer) (err error)

func (*WWWFormEncode) Name added in v0.0.3

func (we *WWWFormEncode) Name() string

type XMLEncode added in v0.0.2

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

func NewXMLEncode added in v0.0.2

func NewXMLEncode(obj interface{}) *XMLEncode

func (*XMLEncode) Encode added in v0.0.2

func (x *XMLEncode) Encode(w io.Writer) error

func (*XMLEncode) Name added in v0.0.3

func (x *XMLEncode) Name() string

type YAMLEncode added in v0.0.2

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

func NewYAMLEncode added in v0.0.2

func NewYAMLEncode(obj interface{}) *YAMLEncode

func (*YAMLEncode) Encode added in v0.0.2

func (y *YAMLEncode) Encode(w io.Writer) error

func (*YAMLEncode) Name added in v0.0.3

func (y *YAMLEncode) Name() string

Jump to

Keyboard shortcuts

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