result

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

result 包含了对微信接口所有错误返回信息的定义

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Code    int    `json:"errcode,omitempty"`
	Message string `json:"errmsg,omitempty"`
}

Result 描述了微信和 http 状态码,其中 [0,400) 区间的为非错误代码; [400,600) 之间的为 HTTP 错误代码; [600,40000) 之间的自定义的错误代码; [40000,) 为微信的错误代码 NOTE: 当将 Result 当作一个 error 时,请确保 Result.IsOK() 为 false。

func From

func From(data []byte) *Result

From 将一段字符串转换成 Result 实例。

func New

func New(code int) *Result

New 声明一个 Result 实例

func (*Result) Error

func (r *Result) Error() string

Error 实现 error 接口内容,在 IsOK 为 false 时,可以将 Result 当作一个 error 实例来使用。

func (*Result) IsOK

func (r *Result) IsOK() bool

IsOK 该结果是否正常返回。

Jump to

Keyboard shortcuts

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