result

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeBoolOk   = true
	CodeBoolFail = false
)
View Source
const (
	OK           = "OK"
	Fail         = "OK"
	Created      = "Created"
	Accepted     = "Accepted"
	NoContent    = "No Content"
	ResetContent = "Reset Content"

	BadRequest   = "Bad Request"
	Unauthorized = "Unauthorized"
	Forbidden    = "Forbidden"
	NotFound     = "Not Found"

	InternalServerError   = "Internal Server Error"
	InternalServerTimeout = "Internal Server Processing Timeout"
)
View Source
const (
	MessageOK           = "请求成功"
	MessageCreated      = "已成功创建资源"
	MessageAccepted     = "已经接受请求, 处理中"
	MessageNoContent    = "处理成功, 无其他响应信息"
	MessageResetContent = "已成功重置数据"

	MessageFail         = "请求失败"
	MessageBadRequest   = "请求的语法错误,服务器无法理解"
	MessageUnauthorized = "身份未认证"
	MessageForbidden    = "没有权限, 请求被服务器拒绝了"
	MessageNotFound     = "所请求的资源不存在"

	MessageInternalServerError   = "服务器内部错误, 无法完成请求"
	MessageInternalServerTimeout = "服务器处理超时"
)

Variables

This section is empty.

Functions

func DefaultJSON

func DefaultJSON(code interface{}, message string) interface{}

Types

type DefaultResp

type DefaultResp struct {
	Code    interface{} `json:"code"`
	Message string      `json:"message"`
}

type HttpError

type HttpError struct {
	HttpStatusCode int         `json:"-"`
	Code           interface{} `json:"code"`
	Message        string      `json:"message"`
}

func Err2HttpError

func Err2HttpError(err error, code interface{}) *HttpError

func Error

func Error(code interface{}, msg string) *HttpError

func (*HttpError) Error

func (err *HttpError) Error() string

func (*HttpError) WithHttpStatusCode

func (err *HttpError) WithHttpStatusCode(httpStatusCode int) *HttpError

type JSON

type JSON map[string]interface{}

Jump to

Keyboard shortcuts

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