Documentation ¶
Index ¶
- Constants
- Variables
- func IsRecordNotFound(err error) bool
- type Config
- type DataBase
- type Page
- type Process
- type ReConfiguration
- func (reConfiguration *ReConfiguration) Close() error
- func (reConfiguration *ReConfiguration) DataBase() DataBase
- 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(c configurator.Configurator) error
- func (reConfiguration *ReConfiguration) SQL() *sql.DB
- type RecordNotFound
- type SortDirection
Constants ¶
View Source
const ( DriverFieldName = "db.driver" DriverDefault = driver.MySQL )
Variables ¶
View Source
var ( Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, reConfiguration.Component, mysql.Component, sqlite.Component, info.Component, runner.Component, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(dataBaseClient *ReConfiguration) *Process { return NewProcess(dataBaseClient) }, func(dataBaseClient *Process) DataBase { return dataBaseClient }, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Driver, DriverFieldName, DriverDefault, fmt.Sprintf( "database connection driver. Available drivers [%s]", strings.Join([]string{driver.MySQL, driver.SQLite}, ","), )) }) }, Run: app.Run(func(container container.Container) error { return container.Invoke(func( dataBaseClient *ReConfiguration, reConfiguration reConfiguration.ReConfiguration, informer logger.Informer, info info.Info, config *Config, process *Process, runner runner.Runner, ) error { reConfiguration.Registration(dataBaseClient) informer.Info("data_base: registration in the reConfigurator") info.Registration("data_base", config) return runner.AddProcesses(process) }) }), } MySQLComponent = &app.Component{ Dependencies: app.Components{ mysql.Component, runner.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( func(dataBaseClient *mysql.ReConfiguration) *Process { return NewProcess(dataBaseClient) }, func(dataBaseClient *Process) DataBase { return dataBaseClient }, ) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( process *Process, runner runner.Runner, ) error { return runner.AddProcesses(process) }) }), } SQLiteComponent = &app.Component{ Dependencies: app.Components{ sqlite.Component, runner.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( func(dataBaseClient *sqlite.ReConfiguration) *Process { return NewProcess(dataBaseClient) }, func(dataBaseClient *Process) DataBase { return dataBaseClient }, ) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( process *Process, runner runner.Runner, ) error { return runner.AddProcesses(process) }) }), } )
Functions ¶
func IsRecordNotFound ¶
Types ¶
type Config ¶
type Config struct {
Driver string
}
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type DataBase ¶
type DataBase interface { io.Closer Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row Exec(string, ...interface{}) (sql.Result, error) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error) QueryRowContext(context.Context, string, ...interface{}) *sql.Row ExecContext(context.Context, string, ...interface{}) (sql.Result, error) SQL() *sql.DB DriverName() string }
type Page ¶
type Page struct { Number uint32 Limit uint8 ColumnNameToSort string SortDirection SortDirection }
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(informer logger.Informer, container container.Container, config *Config, configurator configurator.Configurator) (*ReConfiguration, error)
func (*ReConfiguration) Close ¶
func (reConfiguration *ReConfiguration) Close() error
func (*ReConfiguration) DataBase ¶
func (reConfiguration *ReConfiguration) DataBase() DataBase
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(c configurator.Configurator) error
func (*ReConfiguration) SQL ¶
func (reConfiguration *ReConfiguration) SQL() *sql.DB
type RecordNotFound ¶
type RecordNotFound struct {
// contains filtered or unexported fields
}
func NewRecordNotFound ¶
func NewRecordNotFound(error string) *RecordNotFound
func (*RecordNotFound) Error ¶
func (recordNotFound *RecordNotFound) Error() string
type SortDirection ¶
type SortDirection uint
const ( ASC SortDirection = iota DESC )
func (SortDirection) String ¶
func (i SortDirection) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.