Version: v1.0.4 Latest Latest

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 18 Imported by: 3




This section is empty.


This section is empty.


func BindJson

func BindJson(c *gin.Context, obj interface{}) error

func BindQuery

func BindQuery(c *gin.Context, obj interface{}) error

func BindUri

func BindUri(c *gin.Context, obj interface{}) error

func Data

func Data(c *gin.Context, args ...interface{})

func ExtractBody

func ExtractBody(c *gin.Context) (body []byte, err error)

func ExtractI18nBundle

func ExtractI18nBundle(c *gin.Context) *i18n.Bundle

func ExtractLocalizer

func ExtractLocalizer(c *gin.Context) *i18n.Localizer

func Fail

func Fail(c *gin.Context, status, code int, msg string, data interface{}, hints ...interface{})

func FailError

func FailError(c *gin.Context, err error, hints ...interface{})

func FailErrorWithData

func FailErrorWithData(c *gin.Context, err error, data interface{})

func FailServer

func FailServer(c *gin.Context, err error, hints ...interface{})

func IsDebug

func IsDebug() bool

func Limit

func Limit(l, max, _default int) int

func Localize

func Localize(b *i18n.Bundle, lang, id string, paras ...interface{}) string

func LocalizeCtx

func LocalizeCtx(c *gin.Context, id string, paras ...interface{}) string

func Log

func Log(in *time.Location) gin.HandlerFunc

func MustLocalize

func MustLocalize(b *i18n.Bundle, lang, id string, paras ...interface{}) string

func NewI18nBundle

func NewI18nBundle(defaultLang language.Tag, rootPath string) *i18n.Bundle

func OK

func OK(c *gin.Context, args ...interface{})

OK() 将 args 构造成 map 然后转成 json 如果 args length 为 1,直接解析成 json

func OKWithString

func OKWithString(c *gin.Context, text string)

func OkWithPagination

func OkWithPagination(c *gin.Context, cursor string, args ...interface{})


func Response

func Response(c *gin.Context, code int, obj interface{})

func TransformJsonKeys

func TransformJsonKeys(data []byte, transformer JsonKeyTransformer) []byte

func TransformRequestJsonKey

func TransformRequestJsonKey(fn JsonKeyTransformer) gin.HandlerFunc

func TransformResponseJsonKey

func TransformResponseJsonKey(fn JsonKeyTransformer) gin.HandlerFunc

func UseI18nBundle

func UseI18nBundle(b *i18n.Bundle) gin.HandlerFunc


type JSONString

type JSONString string

func (JSONString) MarshalJSON

func (s JSONString) MarshalJSON() ([]byte, error)

type JsonKeyTransformer

type JsonKeyTransformer func(string) string

func TransformWithDict

func TransformWithDict(fn JsonKeyTransformer, dict map[string]string) JsonKeyTransformer

func TransformWithWhitelists

func TransformWithWhitelists(fn JsonKeyTransformer, list ...string) JsonKeyTransformer

func (JsonKeyTransformer) WithDict

func (fn JsonKeyTransformer) WithDict(dict map[string]string) JsonKeyTransformer

func (JsonKeyTransformer) WithWhitelist

func (fn JsonKeyTransformer) WithWhitelist(list ...string) JsonKeyTransformer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL