Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type MySQL
- func (mysql *MySQL) Close() error
- func (mysql *MySQL) DriverName() string
- func (mysql *MySQL) Exec(s string, i ...interface{}) (sql.Result, error)
- func (mysql *MySQL) ExecContext(ctx context.Context, s string, i ...interface{}) (sql.Result, error)
- func (mysql *MySQL) Query(s string, i ...interface{}) (*sql.Rows, error)
- func (mysql *MySQL) QueryContext(ctx context.Context, s string, i ...interface{}) (*sql.Rows, error)
- func (mysql *MySQL) QueryRow(s string, i ...interface{}) *sql.Row
- func (mysql *MySQL) QueryRowContext(ctx context.Context, s string, i ...interface{}) *sql.Row
- func (mysql *MySQL) SQL() *sql.DB
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Close() error
- func (reConfiguration *ReConfiguration) DriverName() string
- func (reConfiguration *ReConfiguration) Exec(s string, i ...interface{}) (sql.Result, error)
- func (reConfiguration *ReConfiguration) ExecContext(ctx context.Context, s string, i ...interface{}) (sql.Result, error)
- func (reConfiguration *ReConfiguration) MySQL() *ReConnect
- func (reConfiguration *ReConfiguration) Query(s string, i ...interface{}) (*sql.Rows, error)
- func (reConfiguration *ReConfiguration) QueryContext(ctx context.Context, s string, i ...interface{}) (*sql.Rows, error)
- func (reConfiguration *ReConfiguration) QueryRow(s string, i ...interface{}) *sql.Row
- func (reConfiguration *ReConfiguration) QueryRowContext(ctx context.Context, s string, i ...interface{}) *sql.Row
- func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
- func (reConfiguration *ReConfiguration) SQL() *sql.DB
- type ReConnect
- func (reConnect *ReConnect) Close() error
- func (reConnect *ReConnect) Connect() error
- func (reConnect *ReConnect) DriverName() string
- func (reConnect *ReConnect) Exec(s string, i ...interface{}) (sql.Result, error)
- func (reConnect *ReConnect) ExecContext(ctx context.Context, s string, i ...interface{}) (sql.Result, error)
- func (reConnect *ReConnect) MySQL() (*MySQL, error)
- func (reConnect *ReConnect) Query(s string, i ...interface{}) (*sql.Rows, error)
- func (reConnect *ReConnect) QueryContext(ctx context.Context, s string, i ...interface{}) (*sql.Rows, error)
- func (reConnect *ReConnect) QueryRow(s string, i ...interface{}) *sql.Row
- func (reConnect *ReConnect) QueryRowContext(ctx context.Context, s string, i ...interface{}) *sql.Row
- func (reConnect *ReConnect) SQL() *sql.DB
Constants ¶
View Source
const ( HostFieldName = "db.mysql.host" PortFieldName = "db.mysql.port" UserFieldName = "db.mysql.auth.user" PasswordFieldName = "db.mysql.auth.password" DataBaseFieldName = "db.mysql.name" HostDefault = "127.0.0.1" PortDefault = uint16(3306) )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, re_configuration.Component, limiter.Component, info.Component, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Host, HostFieldName, HostDefault, "mysql connection host") flagSet.Uint16Var(&config.Port, PortFieldName, PortDefault, "mysql connection port") flagSet.StringVar(&config.User, UserFieldName, "", "mysql login user") flagSet.StringVar(&config.Password, PasswordFieldName, "", "mysql login password") flagSet.StringVar(&config.DataBase, DataBaseFieldName, "", "the name of the mysql database to use") }) }, Run: func(c container.Container) error { mysql, err := container.Get[*ReConfiguration](c) if err != nil { return err } reConfiguration, err := container.Get[configurator.ReConfiguration](c) if err != nil { return err } informer, err := container.Get[logger.Informer](c) if err != nil { return err } reConfiguration.Registration(mysql) informer.Info("data_base.mysql: registration in the reConfigurator") info, err := container.Get[info.Info](c) if err != nil { return err } config, err := container.Get[*Config](c) if err != nil { return err } info.Registration("data_base.mysql", config) return nil }, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string Port uint16 User string Password string `info:"secret"` DataBase string }
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type MySQL ¶
type MySQL struct {
// contains filtered or unexported fields
}
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator, logger logger.Logger) (*MySQL, error)
func (*MySQL) DriverName ¶
func (*MySQL) ExecContext ¶
func (*MySQL) QueryContext ¶
func (*MySQL) QueryRowContext ¶
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(logger logger.Logger, limiter limiter.Limiter, config *Config, configurator configurator.Configurator) *ReConfiguration
func (*ReConfiguration) Close ¶
func (reConfiguration *ReConfiguration) Close() error
func (*ReConfiguration) DriverName ¶
func (reConfiguration *ReConfiguration) DriverName() string
func (*ReConfiguration) Exec ¶
func (reConfiguration *ReConfiguration) Exec(s string, i ...interface{}) (sql.Result, error)
func (*ReConfiguration) ExecContext ¶
func (*ReConfiguration) MySQL ¶
func (reConfiguration *ReConfiguration) MySQL() *ReConnect
func (*ReConfiguration) Query ¶
func (reConfiguration *ReConfiguration) Query(s string, i ...interface{}) (*sql.Rows, error)
func (*ReConfiguration) QueryContext ¶
func (*ReConfiguration) QueryRow ¶
func (reConfiguration *ReConfiguration) QueryRow(s string, i ...interface{}) *sql.Row
func (*ReConfiguration) QueryRowContext ¶
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
func (*ReConfiguration) SQL ¶
func (reConfiguration *ReConfiguration) SQL() *sql.DB
type ReConnect ¶
type ReConnect struct {
// contains filtered or unexported fields
}
func NewReConnect ¶
func NewReConnectWithConfigurator ¶
func NewReConnectWithConfigurator(config *Config, logger logger.Logger, limiter limiter.Limiter, configurator configurator.Configurator) *ReConnect
func (*ReConnect) DriverName ¶
func (*ReConnect) ExecContext ¶
func (*ReConnect) QueryContext ¶
func (*ReConnect) QueryRowContext ¶
Click to show internal directories.
Click to hide internal directories.