basic

package
v2.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 3 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

func StartEnd

func StartEnd(c *gin.Context) (start int, end int)

Types

type Code

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

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

func FailCode(code Code) Result

func Success

func Success(data interface{}) Result

Jump to

Keyboard shortcuts

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