Documentation
¶
Index ¶
- Constants
- type DBConfig
- type DBType
- type MongoAccessLogConfig
- type MongoConfig
- func (this *MongoConfig) AuthMechanismPropertiesMap() map[string]string
- func (this *MongoConfig) AuthMechanismPropertiesString() string
- func (this *MongoConfig) ComposeURI() string
- func (this *MongoConfig) ComposeURIMask(mask bool) string
- func (this *MongoConfig) Host() string
- func (this *MongoConfig) LoadAuthMechanismProperties(properties string)
- func (this *MongoConfig) ParseFromURI(uri string) error
- func (this *MongoConfig) Port() int
- func (this *MongoConfig) Save() error
- func (this *MongoConfig) SetAddr(host string, port uint)
- type MySQLAccessLogConfig
- type MySQLConfig
- type PostgresAccessLogConfig
- type PostgresConfig
Constants ¶
View Source
const ( DBConfigFile = "db.conf" DBTypeMongo = "mongo" DBTypeMySQL = "mysql" DBTypePostgres = "postgres" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBConfig ¶
type DBConfig struct { Type DBType `yaml:"type" json:"type"` // 类型:mongo, mysql, postgres ... IsInitialized bool `yaml:"isInitialized" json:"isInitialized"` // 是否初始化 }
数据库配置
type MongoAccessLogConfig ¶
type MongoAccessLogConfig struct { CleanHour int `yaml:"cleanHour" json:"cleanHour"` // 清理时间,0-23 KeepDays int `yaml:"keepDays" json:"keepDays"` // 保留挺熟 }
访问日志配置
type MongoConfig ¶
type MongoConfig struct { TeaVersion string `yaml:"teaVersion" json:"teaVersion"` URI string `yaml:"uri" json:"uri"` Scheme string `yaml:"scheme" json:"scheme"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` Addr string `yaml:"addr" json:"addr"` AuthEnabled bool `yaml:"authEnabled" json:"authEnabled"` AuthMechanism string `yaml:"authMechanism" json:"authMechanism"` AuthMechanismProperties []*shared.Variable `yaml:"authMechanismProperties" json:"authMechanismProperties"` RequestURI string `yaml:"requestURI" json:"requestURI"` // @TODO 未来版本需要实现 DBName string `yaml:"dbName" json:"dbName"` PoolSize int `yaml:"poolSize" json:"poolSize"` // 连接池大小 Timeout int `yaml:"timeout" json:"timeout"` // 超时时间(秒) // 日志访问配置 AccessLog *MongoAccessLogConfig `yaml:"accessLog" json:"accessLog"` }
MongoDB配置
func (*MongoConfig) AuthMechanismPropertiesMap ¶ added in v0.1.8
func (this *MongoConfig) AuthMechanismPropertiesMap() map[string]string
取得Map形式的认证属性
func (*MongoConfig) AuthMechanismPropertiesString ¶ added in v0.1.8
func (this *MongoConfig) AuthMechanismPropertiesString() string
将认证参数转化为字符串
func (*MongoConfig) ComposeURI ¶ added in v0.1.8
func (this *MongoConfig) ComposeURI() string
组合后的URI
func (*MongoConfig) ComposeURIMask ¶ added in v0.1.8
func (this *MongoConfig) ComposeURIMask(mask bool) string
组合后的URI
func (*MongoConfig) LoadAuthMechanismProperties ¶ added in v0.1.8
func (this *MongoConfig) LoadAuthMechanismProperties(properties string)
分析认证参数
func (*MongoConfig) ParseFromURI ¶ added in v0.1.8
func (this *MongoConfig) ParseFromURI(uri string) error
从URI中分析配置
func (*MongoConfig) SetAddr ¶ added in v0.1.8
func (this *MongoConfig) SetAddr(host string, port uint)
设置地址
type MySQLAccessLogConfig ¶ added in v0.1.9
type MySQLAccessLogConfig struct { CleanHour int `yaml:"cleanHour" json:"cleanHour"` // 清理时间,0-23 KeepDays int `yaml:"keepDays" json:"keepDays"` // 保留挺熟 }
访问日志配置
type MySQLConfig ¶ added in v0.1.8
type MySQLConfig struct { DSN string `yaml:"dsn" json:"dsn"` Addr string `yaml:"addr" json:"addr"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` DBName string `yaml:"dbName" json:"dbName"` PoolSize int `yaml:"poolSize" json:"poolSize"` // 日志访问配置 AccessLog *MySQLAccessLogConfig `yaml:"accessLog" json:"accessLog"` }
MySQL配置
type PostgresAccessLogConfig ¶ added in v0.1.9
type PostgresAccessLogConfig struct { CleanHour int `yaml:"cleanHour" json:"cleanHour"` // 清理时间,0-23 KeepDays int `yaml:"keepDays" json:"keepDays"` // 保留挺熟 }
访问日志配置
type PostgresConfig ¶ added in v0.1.8
type PostgresConfig struct { DSN string `yaml:"dsn" json:"dsn"` Addr string `yaml:"addr" json:"addr"` Username string `yaml:"username" json:"username"` Password string `yaml:"password" json:"password"` DBName string `yaml:"dbName" json:"dbName"` PoolSize int `yaml:"poolSize" json:"poolSize"` // 日志访问配置 AccessLog *PostgresAccessLogConfig `yaml:"accessLog" json:"accessLog"` }
PostgreSQL配置
func DefaultPostgresConfig ¶ added in v0.1.8
func DefaultPostgresConfig() *PostgresConfig
默认的PostgreSQL配置
func LoadPostgresConfig ¶ added in v0.1.8
func LoadPostgresConfig() (*PostgresConfig, error)
加载PostgreSQL配置
func (*PostgresConfig) ComposeDSN ¶ added in v0.1.8
func (this *PostgresConfig) ComposeDSN() string
组合DSN
Click to show internal directories.
Click to hide internal directories.