common

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func JsonFail

func JsonFail(ctx *gin.Context, msg string, data interface{}, codes ...int)

JsonFail serializes the given struct as JSON into the response body.

func JsonFailWithStack

func JsonFailWithStack(ctx *gin.Context, err error, data interface{}, codes ...int)

JsonFailWithStack build a stack of given error and will be logged by Logger then call JsonFail

func JsonSuccess

func JsonSuccess(ctx *gin.Context, msg string, data interface{}, codes ...int)

JsonSuccess serializes the given struct as JSON into the response body.

func ToFailMsg

func ToFailMsg(msg string, data interface{}, codes ...int) gin.H

ToFailMsg returns a preset fail content with gin.H

func ToSuccessMsg

func ToSuccessMsg(msg string, data interface{}, codes ...int) gin.H

ToSuccessMsg returns a preset success content with gin.H

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