Documentation
¶
Index ¶
- Constants
- Variables
- func CallerName(skip int) string
- func CheckTCPPortAvailable(port int) bool
- func CheckUDPPortAvailable(port int) bool
- func CopyBuffer(p []byte, rawData []byte) ([]byte, []byte)
- func CreateDebugGinHttp(skipLogPaths []string) *gin.Engine
- func CreateGinHttp(skipLogPaths []string) *gin.Engine
- func CurrentFuncName() string
- func EnableCORS(engine *gin.Engine)
- func FindAvailablePort(start, end int, protocol TransProtocol) (int, error)
- func FindAvailableTCPPort(start, end int) (int, error)
- func FindAvailableUDPPort(start, end int) (int, error)
- func FindMostSuitableIp(addresses map[string][]string, preferredInterfaces, excludedIpPrefixs []string) string
- func GBKXmlGetRoot(xmlString string) (string, error)
- func GBKXmlUnmarshal(xmlString string, v any) error
- func Get(obj any, getter func() any, failed func() any) any
- func GetAppPath() (base.Result, string)
- func GetAppRealPath() (base.Result, string)
- func GetConfig(configFile string, outStructPtr any) base.Result
- func GetLocalIPAddresses(includeLoopback bool, preferredInterfaces []string) ([]string, error)
- func GetLocalIPAddresses2(includeLoopback bool) (map[string][]string, error)
- func GetString(isNull func() bool, getter func() string) string
- func GetString2(obj any, getter func() string, failed func() string) string
- func GetUnmarshalBool(in any) bool
- func GetUnmarshalDuration(in any) time.Duration
- func GetUnmarshalI32(in any) int32
- func GetUnmarshalI64(in any) int64
- func GetUnmarshalStringArray(in any) []string
- func GetUnmarshalTime(in any) time.Time
- func GetUnmarshalU16(in any) uint16
- func GetUnmarshalU32(in any) uint32
- func GetUnmarshalU8(in any) uint8
- func IsSliceAddressEqual(slice1, slice2 []byte) bool
- func IsSliceAddressEqual2(slice1, slice2 []byte) bool
- func ListenAbortSignal()
- func ListenPanic(abort bool)
- func LoadBuilding(IsDebug bool, ...)
- func LogHttpRequest(params any)
- func ParentFuncName() string
- func ReturnRsp(c *gin.Context, code int, obj any)
- func SetAbortCallback(onAbort func())
- func UnmarshalAny2Any(in any, out any) error
- func UnmarshalJson(data []byte, v any) error
- type Building
- type Counter
- type DMHS
- type FrameRateStatist
- type PerformanceCounter
- func (pc *PerformanceCounter) Average(operationID int) time.Duration
- func (pc *PerformanceCounter) Begin(operationID int)
- func (p *PerformanceCounter) DumpTableAsString(operation_names []string) string
- func (pc *PerformanceCounter) End(operationID int)
- func (pc *PerformanceCounter) Maximum(operationID int) time.Duration
- func (pc *PerformanceCounter) Minimal(operationID int) time.Duration
- func (pc *PerformanceCounter) OpsCount(operationID int) int64
- func (pc *PerformanceCounter) Reset(operationID int)
- func (pc *PerformanceCounter) ResetAll()
- func (pc *PerformanceCounter) Total(operationID int) time.Duration
- type TransProtocol
Constants ¶
View Source
const MAXIMUM_CACHED_FRAMES = 60
View Source
const MAXIMUM_OPERATIONS_COUNT = 64
MAXIMUM_OPERATIONS_COUNT 是最大操作数
Variables ¶
View Source
var AppBuilding = Building{}
Functions ¶
func CallerName ¶
func CheckTCPPortAvailable ¶
CheckTCPPortAvailable 检查指定端口是否可用
func CheckUDPPortAvailable ¶
CheckUDPPortAvailable 检查指定端口是否可用
func CreateDebugGinHttp ¶
func CreateGinHttp ¶
func CurrentFuncName ¶
func CurrentFuncName() string
func EnableCORS ¶
func FindAvailablePort ¶
func FindAvailablePort(start, end int, protocol TransProtocol) (int, error)
FindAvailablePort 在指定范围内查找可用的端口
func FindAvailableTCPPort ¶
FindAvailableTCPPort 在指定范围内查找可用的TCP端口
func FindAvailableUDPPort ¶
FindAvailableUDPPort 在指定范围内查找可用的UDP端口
func FindMostSuitableIp ¶
func GBKXmlGetRoot ¶
GBKXmlGetRoot 函数尝试解析XML的根元素名称
func GBKXmlUnmarshal ¶
GBKXmlUnmarshal 解析`<?xml version="1.0" encoding="GB2312"?>`开头的XML
func GetAppPath ¶
func GetAppPath() (base.Result, string)
func GetAppRealPath ¶
func GetAppRealPath() (base.Result, string)
func GetLocalIPAddresses ¶
func GetLocalIPAddresses2 ¶
func GetUnmarshalBool ¶
func GetUnmarshalDuration ¶
func GetUnmarshalI32 ¶
func GetUnmarshalI64 ¶
func GetUnmarshalStringArray ¶
func GetUnmarshalTime ¶
func GetUnmarshalU16 ¶
func GetUnmarshalU32 ¶
func GetUnmarshalU8 ¶
func IsSliceAddressEqual ¶
func IsSliceAddressEqual2 ¶
func ListenAbortSignal ¶
func ListenAbortSignal()
func ListenPanic ¶
func ListenPanic(abort bool)
func LoadBuilding ¶
func LogHttpRequest ¶
func LogHttpRequest(params any)
func ParentFuncName ¶
func ParentFuncName() string
func SetAbortCallback ¶
func SetAbortCallback(onAbort func())
func UnmarshalAny2Any ¶
func UnmarshalJson ¶
Types ¶
type Building ¶
type Building struct { IsDebug bool // 是否为DEBUG版本 AppShortId string // 应用短ID, E.G.: [app1] AppId string // 应用ID, E.G.: [lx/meeting/app/app1] VersionName string // 版本名称, E.G.: [1.x.x] VersionCode string // 版本ID, E.G.: [20231121.86400] VersionFullName string // 版本全称, E.G.: [1.x.x-20231121.86400] VersionSHA string // 版本SHA值(GIT ID), E.G.: [2c0866ef0] BuildType string // 打包类型, E.G.: [default] BuildTime string // 打包时间, E.G.: [2023.11.21 14:18:20] BuildHost string // 版本来源, E.G.: [Tuyj-T470p] Flavor string // 渠道标记, E.G.: [S] }
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter() *Counter
type DMHS ¶
type DMHS struct {
// contains filtered or unexported fields
}
DMHS 双机热备 Dual-Machine Hot Standby
func (*DMHS) CheckAndWaitStandby ¶
CheckAndWaitStandby 检查并等待就绪
type FrameRateStatist ¶
type FrameRateStatist struct {
// contains filtered or unexported fields
}
func NewFrameRateStatist ¶
func NewFrameRateStatist() *FrameRateStatist
func (*FrameRateStatist) AverageFrameRate ¶
func (f *FrameRateStatist) AverageFrameRate() float64
func (*FrameRateStatist) IncomingFrame ¶
func (f *FrameRateStatist) IncomingFrame()
func (*FrameRateStatist) Reset ¶
func (f *FrameRateStatist) Reset()
func (*FrameRateStatist) TotalFrameCount ¶
func (f *FrameRateStatist) TotalFrameCount() uint64
type PerformanceCounter ¶
type PerformanceCounter struct {
// contains filtered or unexported fields
}
PerformanceCounter 表示性能计数器
func NewPerformanceCounter ¶
func NewPerformanceCounter() *PerformanceCounter
NewPerformanceCounter 创建新的性能计数器
func (*PerformanceCounter) Average ¶
func (pc *PerformanceCounter) Average(operationID int) time.Duration
Average 返回平均时间
func (*PerformanceCounter) DumpTableAsString ¶
func (p *PerformanceCounter) DumpTableAsString(operation_names []string) string
DumpTableAsString 以字符串形式输出性能统计结果
func (*PerformanceCounter) Maximum ¶
func (pc *PerformanceCounter) Maximum(operationID int) time.Duration
Maximum 返回最大时间
func (*PerformanceCounter) Minimal ¶
func (pc *PerformanceCounter) Minimal(operationID int) time.Duration
Minimal 返回最小时间
func (*PerformanceCounter) OpsCount ¶
func (pc *PerformanceCounter) OpsCount(operationID int) int64
OpsCount 返回操作次数
type TransProtocol ¶
type TransProtocol string
const ( ProTcp TransProtocol = "tcp" ProUdp TransProtocol = "udp" ProTcpClient TransProtocol = "tcp-c" ProTcpServer TransProtocol = "tcp-s" )
Click to show internal directories.
Click to hide internal directories.