handler

package
v0.0.0-...-7f41b1e Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonErr

func JsonErr(c *gin.Context, errCode int, data interface{})

JsonErr

use as

handler.JsonErr(c, 0) return

func JsonErrDef

func JsonErrDef(c *gin.Context, def *errdef.ErrDef, errMsgs ...string)

JsonErrDef

use as

handler.JsonErrDef(c, errdef.ErrParams) return

or use add messages, sep of message use string "; "

handler.JsonErrDef(c, errdef.ErrParams, "id", "not found, set id and retry") return

func JsonErrDefErr

func JsonErrDefErr(c *gin.Context, def *errdef.ErrDef, err error, errMsg ...string)

JsonErrDefErr

use as

handler.JsonErrDefErr(c, errdef.ErrDatabase, err) return

or use add messages, sep of message use string "; "

handler.JsonErrDefErr(c, errdef.ErrDatabase, err, "can not found") return

func JsonFail

func JsonFail(c *gin.Context, fail string, data interface{})

JsonFail

use as

handler.JsonFail(c, "fail message") return

func JsonSuccess

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

JsonSuccess

use as

handler.JsonSuccess(c) return

func ParseQueryCommonOffsetAndLimit

func ParseQueryCommonOffsetAndLimit(c *gin.Context) (int, int, error)

ParseQueryCommonOffsetAndLimit

parse query offset and limit
default offset is 0
default limit is 10

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