Documentation ¶
Index ¶
Constants ¶
View Source
const ( MongoDefaultPort = "27017" MongoDefaultDatabase = "bioos" MongoDefaultConnectTimeout = 30 * time.Second MongoDefaultServerSelectionTimeout = 30 * time.Second MongoDefaultSocketTimeout = 30 * time.Second MongoDefaultHeartbeatInterval = 5 * time.Second MongoDefaultMaxConnIdleTime = 30 * time.Second MongoDefaultMaxPoolSize = 100 MongoDefaultMinPoolSize = 1 )
View Source
const ( MySQLDefaultPort = "3306" MySQLDefaultDatabase = "bioos" MySQLDefaultMaxIdleConns = 10 MySQLDefaultMaxOpenConns = 100 MySQLDefaultCreateBatchSize = 1000 MySQLDefaultConnMaxLifeTime = time.Hour MySQLDefaultConnMaxIdleTime = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoOptions ¶
type MongoOptions struct { Host string `json:"host" mapstructure:"host"` Port string `json:"port" mapstructure:"port"` Username string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password,omitempty"` Database string `json:"database" mapstructure:"database"` ConnectTimeout time.Duration `json:"connectTimeout" mapstructure:"connectTimeout"` ServerSelectionTimeout time.Duration `json:"serverSelectionTimeout" mapstructure:"serverSelectionTimeout"` SocketTimeout time.Duration `json:"socketTimeout" mapstructure:"socketTimeout"` HeartbeatInterval time.Duration `json:"heartbeatInterval" mapstructure:"heartbeatInterval"` MaxConnIdleTime time.Duration `json:"maxConnIdleTime" mapstructure:"maxConnIdleTime"` MaxPoolSize uint64 `json:"maxPoolSize" mapstructure:"maxPoolSize"` MinPoolSize uint64 `json:"minPoolSize" mapstructure:"minPoolSize"` }
func (*MongoOptions) Enabled ¶
func (o *MongoOptions) Enabled() bool
func (*MongoOptions) GetDBInstance ¶
GetDBInstance ...
func (*MongoOptions) Validate ¶
func (o *MongoOptions) Validate() error
Validate validate mongo options is valid.
type MySQLOptions ¶
type MySQLOptions struct { Username string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password,omitempty"` Host string `json:"host" mapstructure:"host"` Port string `json:"port" mapstructure:"port"` Database string `json:"database" mapstructure:"database"` MaxIdleConns int `json:"maxIdleConns" mapstructure:"maxIdleConns"` MaxOpenConns int `json:"maxOpenConns" mapstructure:"maxOpenConns"` CreateBatchSize int `json:"createBatchSize" mapstructure:"createBatchSize,omitempty"` ConnMaxLifetime time.Duration `json:"connMaxLifetime" mapstructure:"connMaxLifetime"` ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" mapstructure:"connMaxIdletime"` }
func (*MySQLOptions) AddFlags ¶
func (o *MySQLOptions) AddFlags(fs *pflag.FlagSet)
func (*MySQLOptions) Enabled ¶
func (o *MySQLOptions) Enabled() bool
func (*MySQLOptions) GetGORMInstance ¶
GetGORMInstance ...
func (*MySQLOptions) Validate ¶
func (o *MySQLOptions) Validate() error
Validate validate log options is valid.
type Options ¶
type Options struct { SQLite3 *SQLite3Options `json:"sqlite3,omitempty" mapstructure:"sqlite3,omitempty"` MySQL *MySQLOptions `json:"mysql,omitempty" mapstructure:"mysql,omitempty"` Mongo *MongoOptions `json:"mongo,omitempty" mapstructure:"mongo,omitempty"` }
type SQLite3Options ¶
type SQLite3Options struct {
File string `json:"file" mapstructure:"file"`
}
SQLite3Options stands for sqlite options.
func NewSQLite3Options ¶
func NewSQLite3Options() *SQLite3Options
NewSQLite3Options return a sqlite option.
func (*SQLite3Options) AddFlags ¶
func (o *SQLite3Options) AddFlags(fs *pflag.FlagSet)
func (*SQLite3Options) Enabled ¶
func (o *SQLite3Options) Enabled() bool
func (*SQLite3Options) GetGORMInstance ¶
GetGORMInstance ...
func (*SQLite3Options) Validate ¶
func (o *SQLite3Options) Validate() error
Click to show internal directories.
Click to hide internal directories.