handler

package
v1.1.19-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CODES = map[Code]string{
	CodeSuccess:               "Success",
	CodeParamsFormat:          "Params error, json format",
	CodeParamsRequired:        "Required params is empty",
	CodeRequestDBFail:         "Search DB error",
	CodeLoginFail:             "Login failed, unable to get user details.",
	CodeTokenExpired:          "Token expired",
	CodeBadUsernameOrPassword: "Account and password are incorrect.",
	CodeUnknownError:          "Unknown error",
}

Functions

This section is empty.

Types

type Code added in v1.1.3

type Code int
const (
	CodeSuccess               Code = 20000
	CodeParamsFormat          Code = 40001
	CodeParamsRequired        Code = 40002
	CodeUnknownError          Code = 500
	CodeRequestDBFail         Code = 50001
	CodeLoginFail             Code = 50008
	CodeTokenExpired          Code = 50014
	CodeBadUsernameOrPassword Code = 60204
)

func (Code) String added in v1.1.3

func (c Code) String() string

type Result

type Result struct {
	Code Code        `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func Fail

func Fail(msg interface{}) Result

func FailCode added in v1.1.3

func FailCode(code Code) Result

func FaileReason added in v1.1.3

func FaileReason(code Code, reason string) Result

func Success

func Success(data interface{}) Result

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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