binding

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding interface {
	// Name Binding对象的名称
	Name() string

	// Bind 解析 http.Response 的func
	// resp 可能是 nil,也可能由于中间件在读取完resp.Body 后未还原body,导致 body为空
	// v 应该是一个指针对象
	Bind(resp *http.Response, body []byte, v interface{}) error
}

Binding 解析 http.Response 的接口定义

type JSON

type JSON struct{}

JSON bind json

func (*JSON) Bind

func (j *JSON) Bind(resp *http.Response, body []byte, out interface{}) error

Bind json bind

func (JSON) Name

func (j JSON) Name() string

Name name

type XML

type XML struct{}

XML binding obj

func (*XML) Bind

func (x *XML) Bind(resp *http.Response, body []byte, out interface{}) error

Bind 将 http.Response 响应解析到 out 对象中

func (XML) Name

func (x XML) Name() string

Name name of binding obj

Jump to

Keyboard shortcuts

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