getWay

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentUserIdKey = "userID"
View Source
const CurrentUserKey = "userInfo"
View Source
const StartTimeKey = "StartTime"

Variables

This section is empty.

Functions

func AssertThrowsGetWayErr

func AssertThrowsGetWayErr(throwable bool, code State, subCode, subMsg string)

func AssertThrowsGetWaySErr

func AssertThrowsGetWaySErr(throwable bool, code State, subCode, subMsg string)

func BindRequestBody

func BindRequestBody(c *gin.Context, param interface{}) error

func ExceptionGetWayCatch

func ExceptionGetWayCatch(c *gin.Context)

func FailAndMsg

func FailAndMsg(c *gin.Context, subCode, subMsg string)

func FailAndMsgNoTx

func FailAndMsgNoTx(c *gin.Context, subCode, subMsg string)

FailAndMsgNoTx 不带事务

func FailGetWay

func FailGetWay(c *gin.Context, state State, subCode, subMsg string)

func GetAppId

func GetAppId(c *gin.Context) string

func GetClientIP

func GetClientIP(c *gin.Context) string

func GetCurrentUserId

func GetCurrentUserId(c *gin.Context) (int32, bool)

func GetMethod

func GetMethod(c *gin.Context) string

func GetParams

func GetParams(c *gin.Context) string

func GetPlatform

func GetPlatform(c *gin.Context) string

func GetServerIP

func GetServerIP() string

func GetSign

func GetSign(c *gin.Context) string

func GetSourceType added in v0.0.30

func GetSourceType(c *gin.Context) string

func GetStartTime

func GetStartTime(c *gin.Context) int64

func GetTimeStamp

func GetTimeStamp(c *gin.Context) string

func GetToken

func GetToken(c *gin.Context) string

func GetURL

func GetURL(c *gin.Context) string

func GetVersion added in v0.0.30

func GetVersion(c *gin.Context) string

func LogEnd

func LogEnd(c *gin.Context, data interface{})

func SetStartTime

func SetStartTime(c *gin.Context)

func SetToken

func SetToken(v string, c *gin.Context)

func Success

func Success(c *gin.Context)

Success 有事务的用这个

func SuccessData

func SuccessData(c *gin.Context, data interface{})

SuccessData 有事务的用这个

func SuccessDataNoTx

func SuccessDataNoTx(c *gin.Context, data interface{})

SuccessDataNoTx 不带事务提交

func SuccessDataNormal added in v0.0.36

func SuccessDataNormal(c *gin.Context, data interface{})

func SuccessGetWay

func SuccessGetWay(c *gin.Context, state State, subCode, subMsg string)

func SuccessNoTx

func SuccessNoTx(c *gin.Context)

SuccessNoTx 不带事务提交

func SuccessNormal added in v0.0.36

func SuccessNormal(c *gin.Context)

func SuccessString

func SuccessString(c *gin.Context, data string)

func ThrowsGetWayErr

func ThrowsGetWayErr(code State, subCode, subMsg string)

func ThrowsGetWaySErr

func ThrowsGetWaySErr(code State, subCode, subMsg string)

Types

type Admin

type Admin struct {
	Id           int32
	Name         string
	LoginAccount string
}

type AdminResponse

type AdminResponse struct {
	Admin Admin
	// contains filtered or unexported fields
}

type Error

type Error struct {
	Code    State
	SubCode string
	SubMsg  string
}

type SError

type SError struct {
	Code    State
	SubCode string
	SubMsg  string
}

type ServerDataResponse

type ServerDataResponse struct {
	ServerResponse
	Data interface{} `json:"data,omitempty"`
}

type ServerResponse

type ServerResponse struct {
	Code    State  `json:"code"`          //0为成功,其他都是失败
	Msg     string `json:"msg,omitempty"` //非1000情况下的错误描述
	SubCode string `json:"subCode,omitempty"`
	SubMsg  string `json:"subMsg,omitempty"`
}

type State

type State int16
const (
	BusinessError State = 1001
	OK            State = 1000
	Illegal       State = 9000
	LoginFailure  State = -1
)

iota 初始化后会自动递增

func (State) String

func (t State) String() string

Jump to

Keyboard shortcuts

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