Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TRUE = true FALSE = false DefaultDbDriver = "mysql" ErrNoBackend = errors.New("no backend configured") )
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct {
// optional name of driver, if omitted, then "mysql" is assumed
Driver *string `yaml:"driver,omitempty"`
DSN string `yaml:"dsn"`
Create *bool `yaml:"create,omitempty"`
Read *bool `yaml:"read,omitempty"`
Update *bool `yaml:"update,omitempty"`
Delete *bool `yaml:"delete,omitempty"`
// Optional mapping from entity (table) name to ID column.
// If not specified, then "id" is assumed
IdMap *map[string]string `yaml:"id_map,omitempty"`
MaxOpenConnections *int `yaml:"max_open_connections,omitempty"`
MaxIdleConnections *int `yaml:"max_idle_connections,omitempty"`
ConnMaxLifetime *time.Duration `yaml:"conn_max_lifetime,omitempty"`
ConnMaxIdleTime *time.Duration `yaml:"conn_max_idle_time,omitempty"`
// contains filtered or unexported fields
}
func (*BackendConfig) Close ¶
func (be *BackendConfig) Close() error
func (*BackendConfig) DB ¶
func (be *BackendConfig) DB() *sql.DB
func (*BackendConfig) IdColumn ¶
func (be *BackendConfig) IdColumn(ent string) string
IdColumn gets ID column for given entity, see IdMap
func (*BackendConfig) Open ¶
func (be *BackendConfig) Open() error
type Backends ¶
type Backends map[string]*BackendConfig
type Config ¶
type Config struct {
Server ccfg.ServerConfig `yaml:"server"`
Backends Backends `yaml:"backends"`
LoggingConfig *LoggingConfig `yaml:"logging,omitempty"`
}
func (*Config) CheckAndNormalize ¶
CheckAndNormalize sets any missing optional values and ensures all values are semantically correct.
type LoggingConfig ¶
Click to show internal directories.
Click to hide internal directories.