tool

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "Tools"
)

Variables

This section is empty.

Functions

func InspectImgInfo added in v0.1.1

func InspectImgInfo(conname, svcname, namespace, imgname string, callback func(error)) error

InspectImgInfo 获取镜像信息 conname 容器名称, 用于回调时查找容器配置 svcname 服务配置名称,用于回调时确定服务配置 namespace 命名空间名称, 回调时使用 imgname 镜像名称,用于检索镜像数据

func IsNotFound added in v0.1.1

func IsNotFound(err error) bool

IsNotFound 判断返回的错误是否是数据库无记录

func ReturnError

func ReturnError(w http.ResponseWriter, err error)

ReturnError 返回常规错误 响应码为500 如果传入的错误信息不是json格式,将按照字符串格式返回 如果传入的错误信息符合json格式,将按照json格式返回

func ReturnResp added in v0.1.1

func ReturnResp(w http.ResponseWriter, data []byte)

ReturnResp 返回非代码层面的错误. 此错误经常用在返回服务执行成功 但执行的结果是失败的情况 例如服务执行成功,但对方没有返回任何数据,此时返回的响应码为200,但 追加一个没有查询到数据的返回信息

Types

type HttpError

type HttpError struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

Jump to

Keyboard shortcuts

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