Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache 数据库配置缓存
func (*Cache) GetAllServices ¶ added in v1.1.32
func (c *Cache) GetAllServices(ctx context.Context, tenantID int) (map[string]*TenantDatabaseConfig, error)
GetAllServices 获取租户所有服务的数据库配置
func (*Cache) GetByService ¶ added in v1.1.32
func (c *Cache) GetByService(ctx context.Context, tenantID int, serviceCode string) (*TenantDatabaseConfig, error)
GetByService 获取指定服务的数据库配置
type TenantDatabaseConfig ¶
type TenantDatabaseConfig struct {
// 租户信息
TenantID int `json:"tenant_id"`
Code string `json:"code"`
Name string `json:"name"`
// 服务信息
ServiceCode string `json:"service_code"`
// 数据库连接参数
Driver string `json:"driver"`
Host string `json:"host"`
Port int `json:"port"`
DbName string `json:"db_name"`
Username string `json:"username"`
Password string `json:"password"`
SSLMode string `json:"ssl_mode"`
// 连接池设置
MaxOpenConns int `json:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns"`
}
TenantDatabaseConfig 租户数据库配置
Click to show internal directories.
Click to hide internal directories.