Documentation
¶
Index ¶
Constants ¶
View Source
const ( ServerTypeHTTP = "http" // HTTP服务器 DefaultPort = 9106 // 默认端口 DefaultIP = "0.0.0.0" // 默认IP EnvModeNormal = "normal" // 正常模式 EnvModeDebug = "debug" // 调试模式 OSMac = "darwin" // macOS OSLinux = "linux" // Linux OSWindows = "windows" // Windows OSAndroid = "android" // Android OSFreeBSD = "freebsd" // FreeBSD OSDragonfly = "dragonfly" // Dragonfly OSNetBSD = "netbsd" // NetBSD OSPlain = "plan9" // Plan 9 OSSolaris = "solaris" // Solaris OSOpenBSD = "openbsd" // OpenBSD OSUnknown = "unknown" // 未知系统 ConfigName = "tea.toml" // 默认配置文件名 )
Variables ¶
View Source
var ( ConfigFileNotExists = kerr.New(600001, "Config file not exists").WithDisplay("配置文件不存在") DefaultServerNotFound = kerr.New(600002, "Default server not found").WithDisplay("默认服务器未找到") RouterNotFound = kerr.New(600003, "Router not found").WithDisplay("路由器未找到") ListenerNotFound = kerr.New(600004, "Listener not found").WithDisplay("监听器未找到") ResourceNotFound = kerr.New(600005, "Resource not found").WithDisplay("资源未找到") StepError = kerr.New(600006, "Step error").WithDisplay("步骤错误") ServerShutdownError = kerr.New(600007, "Server shutdown error").WithDisplay("服务器关闭错误") ConfigParseError = kerr.New(600008, "Config parse error").WithDisplay("配置解析错误") ServerSetupError = kerr.New(600009, "Server setup error").WithDisplay("服务器设置错误") ConfigKeyNotExists = kerr.New(600010, "Config key not exists").WithDisplay("配置键不存在") )
Base error definitions
Functions ¶
Types ¶
type Output ¶
type Output struct {
Code int `json:"code" dc:"错误码" example:"0"` // 错误码
Msg string `json:"msg" dc:"错误信息" example:"OK"` // 错误信息
Data any `json:"data" dc:"输出数据"` // 输出数据
}
Output 输出结构体
type OutputFormat ¶
type OutputFormat interface {
SetCode(code int)
SetMsg(msg string)
SetData(data any)
String() string
}
OutputFormat 输出格式接口
func Response ¶
func Response() OutputFormat
Click to show internal directories.
Click to hide internal directories.