utils

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReqDate

func ReqDate(s string) time.Time

ReqDate 将客户端提交的日期(比如搜索时的日期范围选择),换算成UTC日期

func ResAPIError

func ResAPIError(c *gin.Context, errcode int, errmsg string)

ResAPIError 返回后端api间调用错误,status始终为200

func ResError

func ResError(c *gin.Context, status int, errcode int, errmsg string)

ResError 返回错误,JSON格式,例{ "errcode": 000001, "errmsg": "参数错误" }

func ResTime

func ResTime(t time.Time) string

ResTime 返回UTC时间,用ISO8601格式化。YYYY-MM-DDTHH:MM:SSZ

func ResValidError added in v0.1.3

func ResValidError(c *gin.Context, e validate.E)

ResValidError 返回validate检测的错误,JSON格式,例{ "errcode": 000001, "errmsg": "参数错误" }

Types

This section is empty.

Jump to

Keyboard shortcuts

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