utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

* * @Description: 获取项目配置信息 * @Author: jinyidong * @Date: 2021/5/19 * @Version V1.0

* * @Description: http response * @Author: jinyidong * @Date: 2021/5/14 * @Version V1.0

Index

Constants

This section is empty.

Variables

View Source
var (
	OK             = response(0, "ok")
	UnKnownError   = response(-1, "unknown error")
	ParseError     = response(-32700, "parse error")
	InvalidRequest = response(-32600, "invalid request")
	MethodNotFound = response(-32601, "method not found")
	InvalidParams  = response(-32602, "invalid params")
	InternalError  = response(-32603, "internal error")
	ServerError    = response(-32000, "server error")
)

Functions

func Dump

func Dump()

func GetConfig

func GetConfig(key string) interface{}

func GetConfigString

func GetConfigString(key string) string

Types

type Response

type Response struct {
	Code   int         `json:"error_code"`
	Msg    string      `json:"error_message"`
	Result interface{} `json:"result"` // 返回数据
}

func (*Response) WithMsg

func (res *Response) WithMsg(message string) Response

自定义响应信息

func (*Response) WithResult

func (res *Response) WithResult(result interface{}) Response

追加响应数据

Jump to

Keyboard shortcuts

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