api

package
v0.0.0-...-1bfb889 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesErrCode = -1
	BotErrCode        = -2

	Success StatusType = "success"
	Failure StatusType = "failure"
)
View Source
const RespMsg = "message"

Variables

This section is empty.

Functions

func AssertErrorType

func AssertErrorType(err interface{}) (code uint, reason, message string)

AssertErrorType is used to get actually type fo error, and get the status code and messages.

func Error

func Error(ctx *gin.Context, e boterrors.APIError)

func ErrorRender

func ErrorRender(ctx *gin.Context, statusCode int, e error, errMsg string)

ErrorRender when statusCode is -1, it means e for k8s error, ErrorRender will extract error code automatically .

func OK

func OK(ctx *gin.Context, data any, total int)

Types

type Data

type Data struct {
	TotalSize int         `json:"total_size"`
	Items     interface{} `json:"items"`
}

type Resp

type Resp map[string]interface{}

type Response

type Response struct {
	Code   int                `json:"code"`
	Status StatusType         `json:"status"`
	Error  boterrors.APIError `json:"error"`
	Data   interface{}        `json:"data"`
}

type StatusType

type StatusType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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