utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Failed                   = "4000"
	FailedParamsError        = "4002"
	FailedRemoteServiceError = "4001"
	FailedUnknown            = "4003"
	FailedDecodeError        = "4004"
	AthorizationError        = "4005"
	JsonError                = "4006"
	ResourceNotFound         = "4007"
	LicenseError             = "4008"
	BiddenError              = "4009"
	RoleChangeNeedReLogin    = "4010"
)

request fail

View Source
const (
	SystemError = "9000"
)

system error

Variables

This section is empty.

Functions

func SendErrorMessage

func SendErrorMessage(c *gin.Context, code int, errorCode string, errorMsg string)

SendErrorMessage select fail

func SendMessage

func SendMessage(c *gin.Context, code int, success bool, data interface{}, errcode, errmsg, host, traceid, showtype string)

func SendSuccessMessage

func SendSuccessMessage(c *gin.Context, code int, data interface{})

SendSuccessMessage select success and have data

Types

type Result

type Result struct {
	Success      bool        `json:"success"`
	Data         interface{} `json:"data"`
	ErrorCode    string      `json:"errorCode"`
	ErrorMessage string      `json:"errorMessage"`
	Host         string      `json:"host"`
	TraceId      string      `json:"traceid"`
	ShowType     string      `json:"showtype"`
}

func (*Result) String

func (r *Result) String() string

Jump to

Keyboard shortcuts

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