Documentation ¶
Overview ¶
Package tgf @Description: 框架基础包
Index ¶
- Constants
- Variables
- func AddDestroyHandler(handler IDestroyHandler)
- func GetStrConfig[T int | int32 | string | int64 | float32 | float64](env Environment) (res T)
- func GetStrListConfig(env Environment) (res []string)
- func InitConfig()
- type CacheModule
- type Environment
- type GameError
- type IDestroyHandler
Constants ¶
View Source
const ( // RuntimeModuleDev 开发环境 RuntimeModuleDev = "dev" // RuntimeModuleTest 测试环境 RuntimeModuleTest = "test" // RuntimeModuleRelease 生产环境 RuntimeModuleRelease = "release" )
运行环境
View Source
const ( ContextKeyUserId = "UserId" ContextKeyRPCType = "RPCType" ContextKeyTemplateUserId = "TemplateUserId" ContextKeyNodeId = "NodeId" ContextKeyCloseLocalCache = "CloseLocalCache" ContextKeyBroadcastUserIds = "BroadcastUserIds" ContextKeyTRACEID = "TraceId" ContextKeyHash = "__hash" )
View Source
const ( RPCTip = "rpc_tip" RPCBroadcastTip = "rpc_broadcast_tip" )
View Source
const AdminServiceModuleName = "admin"
View Source
const GatewayServiceModuleName = "gate"
View Source
const Logo = `` /* 738-byte string literal not displayed */
View Source
const MonitorServiceModuleName = "monitor"
View Source
const (
RedisKeyUserNodeMeta = "user:node:meta:%v"
)
redisKey
Variables ¶
View Source
var ( ErrorRPCTimeOut = errors.New("rpc time out") LocalEmpty = errors.New("local cache empty") RedisEmpty = errors.New("redis cache empty") DBEmpty = errors.New("db cache empty") )
View Source
var NodeId = ""
View Source
var ServerModule = false
Functions ¶
func AddDestroyHandler ¶
func AddDestroyHandler(handler IDestroyHandler)
func GetStrConfig ¶
func GetStrListConfig ¶
func GetStrListConfig(env Environment) (res []string)
func InitConfig ¶
func InitConfig()
Types ¶
type CacheModule ¶
type CacheModule int
const ( CacheModuleRedis CacheModule = iota CacheModuleClose )
type Environment ¶
type Environment string
const ( // EnvironmentLoggerPath 日志输出路径 EnvironmentLoggerPath Environment = "LogPath" // EnvironmentLoggerLevel 日志最低输出级别 EnvironmentLoggerLevel Environment = "LogLevel" EnvironmentLoggerIgnoredTags Environment = "LogIgnoredTags" // EnvironmentRuntimeModule 运行环境,有以下可选运行环境 // dev test release // RuntimeModuleDev RuntimeModuleTest RuntimeModuleRelease EnvironmentRuntimeModule Environment = "RuntimeModule" // EnvironmentConsulAddress consul地址 EnvironmentConsulAddress Environment = "ConsulAddress" // EnvironmentConsulPath consul路径 // // 默认使用/tgf,如需区分不同环境可以使用自定义的不同的路径 例如 /test 或者 /dev /tim EnvironmentConsulPath Environment = "ConsulPath" // EnvironmentRedisAddr redis地址 127.0.0.1::6379 EnvironmentRedisAddr Environment = "RedisAddr" // EnvironmentRedisPassword redis密码 EnvironmentRedisPassword Environment = "RedisPassword" // EnvironmentRedisDB redis的db EnvironmentRedisDB Environment = "RedisDB" // EnvironmentRedisCluster redis cluster 开关 0 关闭 1 开启,默认关闭 EnvironmentRedisCluster Environment = "RedisCluster" // EnvironmentMySqlUser mysql用户名 EnvironmentMySqlUser Environment = "MySqlUser" // EnvironmentMySqlPwd mysql密码 EnvironmentMySqlPwd Environment = "MySqlPwd" // EnvironmentMySqlAddr mysql地址 EnvironmentMySqlAddr Environment = "MySqlAddr" // EnvironmentMySqlPort mysql端口 EnvironmentMySqlPort Environment = "MySqlPort" // EnvironmentMySqlDB mysql库 EnvironmentMySqlDB Environment = "MySqlDB" // EnvironmentServicePort 当前进程提供的服务端口 EnvironmentServicePort = "ServicePort" EnvironmentServiceAddress = "ServiceAddress" EnvironmentGatePush = "GatePush" )
环境变量
type IDestroyHandler ¶
type IDestroyHandler interface {
Destroy()
}
Directories ¶
Path | Synopsis |
---|---|
Package db @Description: 数据缓存相关 @Link https://github.com/bsm/redislock redis分布式锁
|
Package db @Description: 数据缓存相关 @Link https://github.com/bsm/redislock redis分布式锁 |
Package log @Description: log包,日志相关业务 @Link https://github.com/natefinch/lumberjack @Link https://github.com/uber-go/zap
|
Package log @Description: log包,日志相关业务 @Link https://github.com/natefinch/lumberjack @Link https://github.com/uber-go/zap |
Package rpc @Description: rpc的封装,使用了rpcx框架 @Link: https://doc.rpcx.io/part4/alias.html rpcx框架 @Ref:
|
Package rpc @Description: rpc的封装,使用了rpcx框架 @Link: https://doc.rpcx.io/part4/alias.html rpcx框架 @Ref: |
Package util @Description: 工具包 @Link: https://github.com/panjf2000/ants 是一个高性能且低损耗的 goroutine 池 @Ref:
|
Package util @Description: 工具包 @Link: https://github.com/panjf2000/ants 是一个高性能且低损耗的 goroutine 池 @Ref: |
Click to show internal directories.
Click to hide internal directories.