Documentation ¶
Index ¶
- Variables
- func GenMD5Sign(data interface{}, key string) (d interface{}, err error)
- func GenSign(data []byte, privateKey []byte) (sign []byte, err error)
- func JsonDecode(p []byte, v interface{}) error
- func JsonEncode(v interface{}) ([]byte, error)
- func MD5(str string) string
- func SetBackend(backend SupportedBackend, b Backend)
- func Struct2Map(obj interface{}) map[string]interface{}
- func Verify(data []byte, publicKey []byte, sign []byte) (err error)
- func Version() string
- type ApiBackend
- type Backend
- type Backends
- type CommonRequest
- type SupportedBackend
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Key string OsInfo string LogLevel = 2 )
Functions ¶
func GenMD5Sign ¶
func JsonDecode ¶
简单封装了json的UnMarshal功能 Example pingpp.JsonDecode(param1, param2) param1:需要转换成结构体的json数据 param2:转换后数据容器
func JsonEncode ¶
简单封装了json的Marshal功能 pingpp.JsonEncode(param1)
func Struct2Map ¶
func Struct2Map(obj interface{}) map[string]interface{}
Types ¶
type ApiBackend ¶
type ApiBackend struct { Type SupportedBackend URL string HTTPClient *http.Client }
ApiBackend api相关的后端类型
func (ApiBackend) Call ¶
func (s ApiBackend) Call(method, path, key string, form *url.Values, params []byte, v interface{}) error
Call 后端处理请求方法
func (*ApiBackend) Do ¶
func (s *ApiBackend) Do(req *http.Request, v interface{}) error
Do 处理 http 请求
func (*ApiBackend) NewRequest ¶
func (s *ApiBackend) NewRequest(method, path, key, contentType string, body io.Reader, params []byte) (*http.Request, error)
NewRequest 建立http请求对象
type Backend ¶
type CommonRequest ¶
type CommonRequest struct {
AppID string
}
type SupportedBackend ¶
type SupportedBackend string
const ( TotalBackends = 1 APIBackend SupportedBackend = "api" )
Click to show internal directories.
Click to hide internal directories.