httpmvc

package
v1.8.11 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrafficKey = "X-Request-Id"
	LoggerKey  = "_sansan-logger-request"
)

Variables

This section is empty.

Functions

func Assert

func Assert(condition bool, msg string, code ...int)

Assert 条件断言 当断言条件为 假 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码

func CompareHashAndPassword

func CompareHashAndPassword(e string, p string) (bool, error)

func GenerateMsgIDFromContext

func GenerateMsgIDFromContext(c *gin.Context) string

GenerateMsgIDFromContext 生成msgID

func GetOrm

func GetOrm(c *gin.Context) (*gorm.DB, error)

GetOrm 获取orm连接

func HasError

func HasError(err error, msg string, code ...int)

HasError 错误断言 当 error 不为 nil 时触发 panic 对于当前请求不会再执行接下来的代码,并且返回指定格式的错误信息和错误码 若 msg 为空,则默认为 error 中的内容

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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