common

package
v0.0.0-...-9e8b3cb Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyAuthorization = "Authorization"
	KeyUUID          = "UUID"

	KeyUserAgent           = "User-Agent"
	KeyContextPara         = "_key_ctx_para"
	KeyContextResponse     = "_key_ctx_response"
	KeyContextUserId       = "_key_ctx_userId_"
	KeyContextRequestId    = "X-Reqid"
	KeyContextResponseCode = "_key_ctx_response_code"
)

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(str string) string

Capitalize 字符首字母大写

func GetIp

func GetIp(r *http.Request) string

获取IP

func Md5

func Md5(text string) string

func Para

func Para(c *gin.Context) interface{}

func ResToMap

func ResToMap(rows *sql.Rows) map[string]string

把查询数据库的结果集转换成map

func Response

func Response(c *gin.Context) interface{}

func SaveMapData

func SaveMapData(key string, data interface{}) interface{}

组合数据

FIXME 此处方法名需要重新命名 否则会产生干扰

func TransformVersionToInt

func TransformVersionToInt(version string) int

func UUID

func UUID(ctx *gin.Context) string

func UserId

func UserId(ctx *gin.Context) int64

func UserToken

func UserToken(ctx *gin.Context) string

func XRequestId

func XRequestId(ctx *gin.Context) string

Types

type CompareState

type CompareState int
const (
	CompareVersionStateFailed CompareState = iota
	CompareVersionStateGreater
	CompareVersionStateEqual
	CompareVersionStateLess
)

func VersionCompare

func VersionCompare(version1, version2 string) (CompareState, error)

版本号规则xx.xx.xx 只能有数字和点 version1

Jump to

Keyboard shortcuts

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