Documentation
¶
Index ¶
- func BindJson(c *gin.Context, obj interface{}) error
- func BindQuery(c *gin.Context, obj interface{}) error
- func BindUri(c *gin.Context, obj interface{}) error
- func Data(c *gin.Context, args ...interface{})
- func ExtractBody(c *gin.Context) (body []byte, err error)
- func ExtractI18nBundle(c *gin.Context) *i18n.Bundle
- func ExtractLocalizer(c *gin.Context) *i18n.Localizer
- func Fail(c *gin.Context, status, code int, msg string, data interface{}, ...)
- func FailError(c *gin.Context, err error, hints ...interface{})
- func FailErrorWithData(c *gin.Context, err error, data interface{})
- func FailServer(c *gin.Context, err error, hints ...interface{})
- func IsDebug() bool
- func Limit(l, max, _default int) int
- func Localize(b *i18n.Bundle, lang, id string, paras ...interface{}) string
- func LocalizeCtx(c *gin.Context, id string, paras ...interface{}) string
- func Log(in *time.Location) gin.HandlerFunc
- func MustLocalize(b *i18n.Bundle, lang, id string, paras ...interface{}) string
- func NewI18nBundle(defaultLang language.Tag, rootPath string) *i18n.Bundle
- func OK(c *gin.Context, args ...interface{})
- func OKWithString(c *gin.Context, text string)
- func OkWithPagination(c *gin.Context, cursor string, args ...interface{})
- func Response(c *gin.Context, code int, obj interface{})
- func TransformJsonKeys(data []byte, transformer JsonKeyTransformer) []byte
- func TransformRequestJsonKey(fn JsonKeyTransformer) gin.HandlerFunc
- func TransformResponseJsonKey(fn JsonKeyTransformer) gin.HandlerFunc
- func UseI18nBundle(b *i18n.Bundle) gin.HandlerFunc
- type JSONString
- type JsonKeyTransformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailErrorWithData ¶
func FailServer ¶
func OKWithString ¶
func OkWithPagination ¶
pagination
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
Types ¶
type JSONString ¶
type JSONString string
func (JSONString) MarshalJSON ¶
func (s JSONString) MarshalJSON() ([]byte, error)
type JsonKeyTransformer ¶
var ToCamelKey JsonKeyTransformer = strcase.ToLowerCamel
var ToSnakeKey JsonKeyTransformer = strcase.ToSnake
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
Click to show internal directories.
Click to hide internal directories.