ginApp

package
v0.0.0-...-44a0b5b Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// head field
	HeadLocale      = "locale"
	HeadToken       = "token"
	HeadUserAgent   = "User-Agent"
	HeadContentType = "Content-Type"
	// ctx key
	KeyUID            = "uid"
	KeyTeam           = "team"
	KeyTrans          = "trans"
	KeyApp            = "app"
	KeyAuthUser       = "authUser"
	KeyInitOnce       = "initOnce"
	KeyProcBeginTime  = "procBeginTime"
	KeyNotSaveResp    = "notSaveResp"
	KeyNotTrace       = "notTrace"
	KeyResp           = "resp"
	KeyReqID          = "reqID"
	KeyApiCacheKey    = "apiCacheKey"
	KeyApiCacheExpire = "apiCacheExpire"
	KeyRoles          = "roles"
	KeyStatusCode     = "statusCode"
	KeyProcTime       = "procTime"
)

Variables

This section is empty.

Functions

func Cors

func Cors() gin.HandlerFunc

func ErrHandler

func ErrHandler(c *gin.Context)

func LogFormatter

func LogFormatter(p gin.LogFormatterParams) string

func PrepareProc

func PrepareProc(c *gin.Context)

middleware

Types

type App

type App struct {
	C *gin.Context
	// contains filtered or unexported fields
}

func GetApp

func GetApp(c *gin.Context) *App

func (*App) BadReq

func (app *App) BadReq()

func (*App) CommonError

func (app *App) CommonError(err error)

func (*App) Data

func (app *App) Data(data interface{})

func (*App) ErrorMsg

func (app *App) ErrorMsg(msg string)

func (*App) GetApiCacheExpire

func (app *App) GetApiCacheExpire() *time.Duration

func (*App) GetApiCacheKey

func (app *App) GetApiCacheKey() *string

func (*App) GetContentType

func (app *App) GetContentType() string

func (*App) GetCtxRespVal

func (app *App) GetCtxRespVal() *fastcurd.RetJSON

func (*App) GetFullReqURL

func (app *App) GetFullReqURL() string

func (*App) GetLocale

func (app *App) GetLocale() string

head field helper

func (*App) GetNotSaveResp

func (app *App) GetNotSaveResp() *bool

func (*App) GetNotTrace

func (app *App) GetNotTrace() *bool

func (*App) GetProcBeginTime

func (app *App) GetProcBeginTime() *time.Time

func (*App) GetProcTime

func (app *App) GetProcTime() string

func (*App) GetReqID

func (app *App) GetReqID() string

func (*App) GetStatusCode

func (app *App) GetStatusCode() int

func (*App) GetToken

func (app *App) GetToken() string

func (*App) GetUA

func (app *App) GetUA() string

func (*App) GetUserAgent

func (app *App) GetUserAgent() string

func (*App) IsShouldSaveResp

func (app *App) IsShouldSaveResp() bool

func (*App) JSON

func (app *App) JSON(json *fastcurd.RetJSON)

func (*App) NoAuth

func (app *App) NoAuth()

func (*App) NoChange

func (app *App) NoChange()

func (*App) NoLogin

func (app *App) NoLogin()

func (*App) Ok

func (app *App) Ok(msg string, data ...interface{})

resp helper

func (*App) RateLimitError

func (app *App) RateLimitError()

func (*App) Response

func (app *App) Response(code int, json *fastcurd.RetJSON)

finally resp fn

func (*App) RetData

func (app *App) RetData(data interface{}, msgParam ...string)

func (*App) SendAffectRows

func (app *App) SendAffectRows(affectRows int)

func (*App) SendList

func (app *App) SendList(list interface{}, count int)

func (*App) ServerBad

func (app *App) ServerBad()

func (*App) ServerError

func (app *App) ServerError(err error)

func (*App) SetApiCacheExpire

func (app *App) SetApiCacheExpire(d *time.Duration)

func (*App) SetApiCacheKey

func (app *App) SetApiCacheKey(key string)

func (*App) SetCtxRespVal

func (app *App) SetCtxRespVal(json *fastcurd.RetJSON)

func (*App) SetNotSaveResp

func (app *App) SetNotSaveResp()

func (*App) SetNotTrace

func (app *App) SetNotTrace()

func (*App) SetProcBeginTime

func (app *App) SetProcBeginTime(beginTime *time.Time)

func (*App) SetProcTime

func (app *App) SetProcTime(procTime string)

func (*App) SetReqID

func (app *App) SetReqID(reqID string)

func (*App) SetStatusCode

func (app *App) SetStatusCode(code int)

func (*App) String

func (app *App) String(html string)

func (*App) Success

func (app *App) Success()

func (*App) ValidError

func (app *App) ValidError(err error)

func (*App) XML

func (app *App) XML(xml interface{})

type ServerInfo

type ServerInfo struct {
	Timestamp int64 `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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