Documentation ¶
Index ¶
- Constants
- Variables
- func NewConnector(dsn string) driver.Connector
- type Config
- 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) 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
- func (reConfiguration *ReConfiguration) SQLite() *SQLite
- type SQLite
- func (sqlite *SQLite) Close() error
- func (sqlite *SQLite) DriverName() string
- func (sqlite *SQLite) Exec(s string, i ...interface{}) (sql.Result, error)
- func (sqlite *SQLite) ExecContext(ctx context.Context, s string, i ...interface{}) (sql.Result, error)
- func (sqlite *SQLite) Query(s string, i ...interface{}) (*sql.Rows, error)
- func (sqlite *SQLite) QueryContext(ctx context.Context, s string, i ...interface{}) (*sql.Rows, error)
- func (sqlite *SQLite) QueryRow(s string, i ...interface{}) *sql.Row
- func (sqlite *SQLite) QueryRowContext(ctx context.Context, s string, i ...interface{}) *sql.Row
- func (sqlite *SQLite) SQL() *sql.DB
Constants ¶
View Source
const (
DsnFieldName = "db.sqlite.dsn"
)
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.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.DSN, DsnFieldName, DsnDefault, "sqlite database connection string") }) }, Run: func(c container.Container) error { sqlite, 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(sqlite) informer.Info("data_base.sqlite: 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.sqlite", config) return nil }, }
View Source
var (
DsnDefault = filepath.Join(os.TempDir(), "db")
)
Functions ¶
func NewConnector ¶
Types ¶
type Config ¶
type Config struct {
DSN string
}
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfiguration(logger logger.Logger, config *Config) *ReConfiguration
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(logger logger.Logger, 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) 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
func (*ReConfiguration) SQLite ¶
func (reConfiguration *ReConfiguration) SQLite() *SQLite
type SQLite ¶
type SQLite struct {
// contains filtered or unexported fields
}
func NewSQLiteWithConfigurator ¶
func NewSQLiteWithConfigurator(logger logger.Logger, config *Config, configurator configurator.Configurator) *SQLite
func (*SQLite) DriverName ¶
func (*SQLite) ExecContext ¶
func (*SQLite) QueryContext ¶
func (*SQLite) QueryRowContext ¶
Click to show internal directories.
Click to hide internal directories.