Documentation
¶
Index ¶
- Variables
- func CloseDB() error
- func CreateRootAccountIfNeed() error
- func InitDB()
- func InitLogDB()
- func InitRedisClient() (err error)
- func ParseRedisOption() *redis.Options
- func RedisDecrease(key string, value int64) error
- func RedisDel(key string) error
- func RedisGet(key string) (string, error)
- func RedisSet(key string, value string, expiration time.Duration) error
- type Redis
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
View Source
var LOG_DB *gorm.DB
View Source
var RDB redis.Cmdable
View Source
var RedisEnabled = true
View Source
var SQLiteBusyTimeout = env.Int("SQLITE_BUSY_TIMEOUT", 3000)
View Source
var SQLitePath = "one-api.db"
View Source
var UsingMySQL = false
View Source
var UsingPostgreSQL = false
View Source
var UsingSQLite = false
Functions ¶
func CreateRootAccountIfNeed ¶
func CreateRootAccountIfNeed() error
func InitRedisClient ¶
func InitRedisClient() (err error)
InitRedisClient This function is called after init()
func ParseRedisOption ¶
func ParseRedisOption() *redis.Options
func RedisDecrease ¶
Types ¶
type Redis ¶
type Redis struct { Name string `mapstructure:"name" json:"name" yaml:"name"` // 代表当前实例的名字 Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` // 服务器地址:端口 Password string `mapstructure:"password" json:"password" yaml:"password"` // 密码 DB int `mapstructure:"db" json:"db" yaml:"db"` // 单实例模式下redis的哪个数据库 UseCluster bool `mapstructure:"useCluster" json:"useCluster" yaml:"useCluster"` // 是否使用集群模式 ClusterAddrs []string `mapstructure:"clusterAddrs" json:"clusterAddrs" yaml:"clusterAddrs"` // 集群模式下的节点地址列表 }
Click to show internal directories.
Click to hide internal directories.