Documentation ¶
Index ¶
- Variables
- func GetSiteMode() string
- func LoadEnv(siteMode string)
- type Error
- type Mysql
- type Pub
- type Redis
- type Server
- func (s *Server) FillIp()
- func (s *Server) GetClusterRedis(addrs []string) *redis.ClusterClient
- func (s *Server) GetDb() (*gorm.DB, error)
- func (s *Server) GetDbBySec(sectionDb string) (*gorm.DB, error)
- func (s *Server) GetLog(section string) *logrus.Logger
- func (s *Server) GetRandomEndPoint(serviceName string) (endpoint string, err error)
- func (s *Server) GetRedis(sectionDb string) (*redis.Client, error)
- func (s *Server) GrpcRequestRemote(ctx context.Context, serverName string, req interface{}, reqFactory sd.Factory) (response interface{}, err error)
- func (s *Server) Log() *logrus.Logger
- func (s *Server) Register()
- func (s *Server) SetSiteMode(siteMode string)
- func (s *Server) UnRegister()
- type ZLog
Constants ¶
This section is empty.
Variables ¶
View Source
var K = koanf.New(".")
Functions ¶
func GetSiteMode ¶ added in v1.1.0
func GetSiteMode() string
Types ¶
type Mysql ¶
type Mysql struct { Host string Port int Username string Password string Database string Prefix string Debug bool Logger *logrus.Logger Db *gorm.DB MaxIdleConns int //最大空闲连接数 MaxOpenConns int //最大连接数 ConnMaxLifetime int //分钟 SectionLog string }
type Server ¶
type Server struct { Cluster string Ip string Name string Loger map[string]ZLog Etcd zetcd.Etcd Retry bool Listen map[string]Pub Mysql map[string]Mysql Redis map[string]Redis EtcdDis *zetcd.EtcdDis Service map[string]string //service.key, service.value sync.RWMutex }
func (*Server) GetClusterRedis ¶ added in v1.1.6
GetClusterRedis 获取redis集群
func (*Server) GetDbBySec ¶ added in v1.1.0
GetDbBySec 指定DB
func (*Server) GetRandomEndPoint ¶ added in v1.1.4
GetRandomEndPoint 获取随机的端点
func (*Server) GrpcRequestRemote ¶ added in v1.1.0
func (s *Server) GrpcRequestRemote(ctx context.Context, serverName string, req interface{}, reqFactory sd.Factory) (response interface{}, err error)
GrpcRequestRemote 外部服务
func (*Server) SetSiteMode ¶ added in v1.1.0
func (*Server) UnRegister ¶ added in v1.1.0
func (s *Server) UnRegister()
type ZLog ¶ added in v1.1.0
type ZLog struct { Path string File string Age int64 Rotation int64 Log *logrus.Logger Initialize bool }
func (*ZLog) CheckOrCreateDIr ¶ added in v1.1.0
func (*ZLog) GetFilePath ¶ added in v1.1.0
func (*ZLog) GetRotation ¶ added in v1.1.0
Click to show internal directories.
Click to hide internal directories.