Documentation ¶
Index ¶
- Constants
- func Close()
- func CloseKafka()
- func GetCRDBInfo(platform string) (*cockdbInfo, bool)
- func GetDatabase(dbName registryName) *xorm.EngineGroup
- func GetESConn(esName registryName) *elastic.Client
- func GetEtcdPlatformInfo(platform string) ([]string, error)
- func GetKafkaInfoFromLinkMap(platform string) *kafkaInfoConfig
- func GetMysqlInfoFromLinkMap(platform string) *mysqlInfoConfig
- func GetNatsConn(natsName registryName) *nats.Conn
- func GetPayserverCfgFromLinkMap(platform string) *payserverCfgConfig
- func GetRedisCluster(redisName registryName) *redis.ClusterClient
- func GetRedisInfoFromLinkMap(platform string) *redisInfoConfig
- func GetZrangeBy(min, max string, offset, limit int64) redis.ZRangeBy
- func HandleNatsConfigFields(cfgs ...*NatsConfig) error
- func HandleRedisConfigEncryFields(cfgs ...*RedisConfig) error
- func HandleRedisConfigWithDefault(defaultCfg RedisConfig, cfgs ...*RedisConfig)
- func HandleXormConfigEncryFields(cfgs ...*XormConfig) error
- func HandleXormConfigWithDefault(defaultCfg XormDefaultConfig, cfgs ...*XormGroupConfig)
- func HandleXormGroupConfigEncryFields(cfgs ...*XormGroupConfig) error
- func InitLinkMap(cfg *XormGroupConfig) error
- func InitLinkMapByDataSourceName(dataSourceName string) error
- func InitializeEtcdLinkMap(driver, source string) error
- func InitializeMysqlLinkMap(driver, src string) error
- func InitializeNatsLinkMap(driver, src string) error
- func MakeMarshal(model interface{}) (interface{}, error)
- func MakeUnmarshal(bin []byte, model interface{}) error
- func NewESClientByCfg(cfg ESConfig) (cli *elastic.Client, err error)
- func NewNatsClusterByCfg(cfg NatsConfig) (*nats.Conn, error)
- func NewRedisEngine(cfg RedisConfig) (*redis.ClusterClient, error)
- func NewXormEngine(cfg XormConfig) (*xorm.Engine, error)
- func NewXormEngineGroup(cfg XormGroupConfig) (*xorm.EngineGroup, error)
- func RegisterDatabase(dbName registryName, db *xorm.EngineGroup)
- func RegisterES(esName registryName, cli *elastic.Client)
- func RegisterNats(natsName registryName, n *nats.Conn)
- func RegisterRedis(redisName registryName, r *redis.Client)
- func RegisterRedisCluster(redisName registryName, r *redis.ClusterClient)
- func RegisterRedisScriptCli(redisName registryName, r *RedisScriptCli)
- func RsaDecrypt(str string) (string, error)
- func StartWrite(ok bool)
- func WithSenderDefaultConfig() *sarama.Config
- type ESConfig
- type EtcdConfig
- type EtcdLinkInfo
- type LinkInfo
- type MicroserviceConfig
- type NatsConfig
- type NatsLinkInfo
- type RedisConfig
- type RedisScriptCli
- func (cc *RedisScriptCli) Eval(dir, luaFileName string, keys []string, args ...interface{}) (interface{}, error)
- func (cc *RedisScriptCli) EvalSha(luaFileName string, keys []string, args ...interface{}) (interface{}, error)
- func (cc *RedisScriptCli) LoadScriptFile(fileName string) (string, error)
- func (cc *RedisScriptCli) LoadScripts(dir string) error
- type SendToPotato
- type Sender
- type XormConfig
- type XormDefaultConfig
- type XormEngineGroupPolicy
- type XormGroupConfig
- type ZapLoggerConfig
Constants ¶
View Source
const ( MessagedbDatabase registryName MessagedbShardDatabase MessagedbEncryDatabase MessagedbOldDatabase MessagedbPtsHandleDatabase ChanneldbDatabase ChanneldbMsgShardDatabase ChanneldbEncryDatabase ChanneldbOldDatabase ChanneldbPtsHandleDatabase PotatoDcConfigDatabase PotatoAccountDatabase PotatoUserDatabase PotatoChannelDatabase PotatoGroupDatabase PotatoMonitorDatabase PotatoCommonDatabase PotatoAppliedDatabase PotatoSecurityChatDatabase PotatoPrivateChatHistoryDatabase PotatoSecurityChatDiffMessageDatabase PotatoConfigDatabase PotatoProxyConfigDatabase PotatoUserGpsDatabase PotatoUserBot // schema potato_user_bot PotatoUserSessionDatabase PotatoEmailDatabase GeoDatabase OpenPlatformMgrDatabase GameApiDatabase ShortVideoDatabase PayServerMysql // ========================= redis ========================= MessageRedis MessageShardRedis MessageRedisScri //= "messageRe" UserInfoRedis AuthorizationRedis // 用户session redis BasicGroupRedis // 普通群、超级群信息专用redis MediaPushRedis MediaPullRedis MesageIncreaseRedis SecrityChatRedis = MessageRedis ChannelMessageRedis registryName = 4000 + iota ChannelMessageShardRedis GeoRedis OpenPlatformRedis GameApiRedis ShortVideoRedis PayServerRedis // ========================= nats ========================= PtNats PtRouteNats PtMemNats PtMomentNats PtCircleFriend // ========================= es ========================= PtRedisES Unknown )
Variables ¶
This section is empty.
Functions ¶
func CloseKafka ¶
func CloseKafka()
func GetCRDBInfo ¶
func GetDatabase ¶
func GetDatabase(dbName registryName) *xorm.EngineGroup
************************ base function ******************
func GetEtcdPlatformInfo ¶
func GetKafkaInfoFromLinkMap ¶
func GetKafkaInfoFromLinkMap(platform string) *kafkaInfoConfig
func GetMysqlInfoFromLinkMap ¶
func GetMysqlInfoFromLinkMap(platform string) *mysqlInfoConfig
func GetNatsConn ¶
func GetNatsConn(natsName registryName) *nats.Conn
func GetPayserverCfgFromLinkMap ¶
func GetPayserverCfgFromLinkMap(platform string) *payserverCfgConfig
func GetRedisCluster ¶
func GetRedisCluster(redisName registryName) *redis.ClusterClient
func GetRedisInfoFromLinkMap ¶
func GetRedisInfoFromLinkMap(platform string) *redisInfoConfig
func HandleNatsConfigFields ¶
func HandleNatsConfigFields(cfgs ...*NatsConfig) error
func HandleRedisConfigEncryFields ¶
func HandleRedisConfigEncryFields(cfgs ...*RedisConfig) error
func HandleRedisConfigWithDefault ¶
func HandleRedisConfigWithDefault(defaultCfg RedisConfig, cfgs ...*RedisConfig)
func HandleXormConfigEncryFields ¶
func HandleXormConfigEncryFields(cfgs ...*XormConfig) error
func HandleXormConfigWithDefault ¶
func HandleXormConfigWithDefault(defaultCfg XormDefaultConfig, cfgs ...*XormGroupConfig)
func HandleXormGroupConfigEncryFields ¶
func HandleXormGroupConfigEncryFields(cfgs ...*XormGroupConfig) error
func InitLinkMap ¶
func InitLinkMap(cfg *XormGroupConfig) error
func InitializeEtcdLinkMap ¶
func InitializeMysqlLinkMap ¶
func InitializeNatsLinkMap ¶
func NewNatsClusterByCfg ¶
func NewNatsClusterByCfg(cfg NatsConfig) (*nats.Conn, error)
func NewRedisEngine ¶
func NewRedisEngine(cfg RedisConfig) (*redis.ClusterClient, error)
func NewXormEngine ¶
func NewXormEngine(cfg XormConfig) (*xorm.Engine, error)
func NewXormEngineGroup ¶
func NewXormEngineGroup(cfg XormGroupConfig) (*xorm.EngineGroup, error)
func RegisterDatabase ¶
func RegisterDatabase(dbName registryName, db *xorm.EngineGroup)
func RegisterES ¶
func RegisterNats ¶
func RegisterNats(natsName registryName, n *nats.Conn)
func RegisterRedis ¶
func RegisterRedisCluster ¶
func RegisterRedisCluster(redisName registryName, r *redis.ClusterClient)
func RegisterRedisScriptCli ¶
func RegisterRedisScriptCli(redisName registryName, r *RedisScriptCli)
func RsaDecrypt ¶
func StartWrite ¶
func StartWrite(ok bool)
func WithSenderDefaultConfig ¶
Types ¶
type EtcdConfig ¶
type EtcdConfig struct { // platform Platform string `yaml:"Platform"` // Endpoints is a list of URLs. Endpoints []string `yaml:"Endpoints"` // AutoSyncInterval is the interval to update endpoints with its latest members. // 0 disables auto-sync. By default auto-sync is disabled. AutoSyncInterval time.Duration `yaml:"AutoSyncInterval"` // DialTimeout is the timeout for failing to establish a connection. DialTimeout time.Duration `yaml:"DialTimeout"` // Username is a username for authentication. Username string `yaml:"Username"` // Password is a password for authentication. Password string `yaml:"Password"` }
type EtcdLinkInfo ¶
type LinkInfo ¶
type LinkInfo struct { UserName string // 用户名 UserPasswd string // 密码 HostInfo string // 链接信息,格式ip:port Platform string // 所属业务 }
func GetMysqlPlatformInfo ¶
type MicroserviceConfig ¶
type NatsConfig ¶
type NatsLinkInfo ¶
func GetNatsPlatformInfo ¶
func GetNatsPlatformInfo(platform string) (*NatsLinkInfo, bool)
type RedisConfig ¶
type RedisConfig struct { redis.ClusterOptions Platform string `yaml:"Platform"` Addrs []string `yaml:"Addrs"` MaxRedirects int `yaml:"MaxRedirects"` ReadOnly bool `yaml:"ReadOnly"` RouteByLatency bool `ymal:"RouteByLatency"` RouteRandomly bool `yaml:"RouteRandomly"` MaxRetries int `yaml:"MaxRetries"` IdleTimeout int64 `yaml:"IdleTimeout"` // 过期时间 单位 分钟 默认5分钟 Password string `yaml:"Password"` PoolSize int `yaml:"PoolSize"` LuaScriptDir string `yaml:"LuaScriptDir"` // lua 脚本路径 IdleCheckFrequency time.Duration `yaml:"IdleCheckFrequency"` // 1h1m1.003002s }
type RedisScriptCli ¶
type RedisScriptCli struct { Cli *redis.ClusterClient // contains filtered or unexported fields }
************************ * author: Dev0026 * createTime: 19-4-2 * updateTime: 19-4-2 * description: ************************
func GetRedisScriptCli ¶
func GetRedisScriptCli(redisName registryName) *RedisScriptCli
func NewRedisScriptCli ¶
func NewRedisScriptCli(cli *redis.ClusterClient) *RedisScriptCli
func (*RedisScriptCli) Eval ¶
func (cc *RedisScriptCli) Eval(dir, luaFileName string, keys []string, args ...interface{}) (interface{}, error)
func (*RedisScriptCli) EvalSha ¶
func (cc *RedisScriptCli) EvalSha(luaFileName string, keys []string, args ...interface{}) (interface{}, error)
func (*RedisScriptCli) LoadScriptFile ¶
func (cc *RedisScriptCli) LoadScriptFile(fileName string) (string, error)
func (*RedisScriptCli) LoadScripts ¶
func (cc *RedisScriptCli) LoadScripts(dir string) error
type SendToPotato ¶
type SendToPotato struct {
// contains filtered or unexported fields
}
func NewSendToPotato ¶
func NewSendToPotato(maxPerSec int32, fn func(string)) *SendToPotato
func NewSendToPotatoWithLevel ¶
func NewSendToPotatoWithLevel(maxPerSec int32, enableLeve zapcore.Level, fn func(string)) *SendToPotato
func (*SendToPotato) EnableLevel ¶
func (s *SendToPotato) EnableLevel(level zapcore.Level)
func (*SendToPotato) Sync ¶
func (s *SendToPotato) Sync() error
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
############### kafka Sender(异步) ###############
func (*Sender) OnSuccess ¶
func (s *Sender) OnSuccess(succFunc func(*sarama.ProducerMessage))
sender 成功时
type XormConfig ¶
type XormConfig struct { SchemaName string `yaml:"SchemaName"` Platform string `yaml:"Platform"` DriverName string `yaml:"DriverName"` // 数据库类型 mysql tidb DataSourceName string `yaml:"DataSourceName"` // 数据库连接 MaxIdleConns int `yaml:"MaxIdleConns"` // 最大空闲连接数 MaxOpenConns int `yaml:"MaxOpenConns"` // 最大连接数 ShowSql bool `yaml:"ShowSql"` // 是否打印sql LogLevel int `yaml:"LogLevel"` // xorm 日志级别 LOG_DEBUG: 0 LOG_INFO: 1 LOG_WARNING: 2 LOG_ERR: 3 LOG_OFF: 4 LOG_UNKNOWN: 5 SqlMapOptionRootDir string `yaml:"SqlMapOptionRootDir"` // sql 文件根目录 SqlTemplateDir string `yaml:"SqlTemplateDir"` // sql 文件目录 ParamStr string `yaml:"ParamStr"` // 连接参数 exp: chatset=utf8mb4 }
type XormDefaultConfig ¶
type XormDefaultConfig struct { GroupPolicy string `yaml:"GroupPolicy"` // 负载策略 GroupPolicyWeight []int `yaml:"GroupPolicyWeight"` // 权重负载策略 对应值 XormConfig XormConfig `yaml:"XormConfigs"` // xorm具体配置 }
type XormEngineGroupPolicy ¶
type XormEngineGroupPolicy int
const ( RandomPolicy XormEngineGroupPolicy = iota // 随机访问负载策略 WeightRandomPolicy // 权重随机访问负载策略 RoundRobinPolicy // 轮询访问负载策略 WeightRoundRobinPolicy // 权重轮询访问负载策略 )
func (XormEngineGroupPolicy) String ¶
func (i XormEngineGroupPolicy) String() string
type XormGroupConfig ¶
type XormGroupConfig struct { GroupPolicy string `yaml:"GroupPolicy"` // 负载策略 GroupPolicyWeight []int `yaml:"GroupPolicyWeight"` // 权重负载策略 对应值 XormConfigs []XormConfig `yaml:"XormConfigs"` // xorm具体配置 }
type ZapLoggerConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.