Documentation ¶
Overview ¶
Package ccd = core_config_data uses the MySQL based table core_config_data for reading and writing configuration paths, scopes and values.
It also provides an option function to load data from core_config_data into a storage service.
Index ¶
- Constants
- Variables
- func WithCoreConfigData(dbrSess dbr.SessionRunner) config.Option
- type DBStorage
- func (dbs *DBStorage) AllKeys() (cfgpath.PathSlice, error)
- func (dbs *DBStorage) Get(key cfgpath.Path) (interface{}, error)
- func (dbs *DBStorage) Set(key cfgpath.Path, value interface{}) error
- func (dbs *DBStorage) SetLogger(l log.Logger) *DBStorage
- func (dbs *DBStorage) Start() *DBStorage
- func (dbs *DBStorage) Stop() error
- type TableCoreConfigData
- type TableCoreConfigDataSlice
Constants ¶
const ( TableIndexCoreConfigData = iota + 1 // Table: core_config_data TableIndexZZZ // the maximum index, which is not available. )
TableIndex... is the index to a table. These constants are guaranteed to stay the same for all Magento versions. Please access a table via this constant instead of the raw table name. TableIndex iotas must start with 0.
Variables ¶
var TableCollection *csdb.Tables
TableCollection handles all tables and its columns. init() in generated Go file will set the value.
Functions ¶
func WithCoreConfigData ¶
func WithCoreConfigData(dbrSess dbr.SessionRunner) config.Option
WithCoreConfigData reads the table core_config_data into the Service and overrides existing values. If the column `value` is NULL entry will be ignored. Stops on errors.
Types ¶
type DBStorage ¶
type DBStorage struct { // All is a SQL statement for the all keys query All *csdb.ResurrectStmt // Read is a SQL statement for selecting a value from a path/key Read *csdb.ResurrectStmt // Write statement inserts or updates a value Write *csdb.ResurrectStmt // contains filtered or unexported fields }
DBStorage connects the MySQL DB with the config.Service type. Implements interface config.Storager.
func MustNewDBStorage ¶
MustNewDBStorage same as NewDBStorage but panics on error. Implements interface config.Storager.
func NewDBStorage ¶
NewDBStorage creates a new pointer with resurrecting prepared SQL statements. Default logger for the three underlying ResurrectStmt type sports to black hole.
All has an idle time of 15s. Read an idle time of 10s. Write an idle time of 30s. Implements interface config.Storager.
func (*DBStorage) AllKeys ¶
AllKeys returns all available keys. Database errors get logged as info message.
func (*DBStorage) Get ¶
Get returns a value from the database by its key. It is guaranteed that the type in the empty interface is a string. It returns nil on error but errors get logged as info message. Error behaviour: NotFound
func (*DBStorage) Set ¶
Set sets a value with its key. Database errors get logged as Info message. Enabled debug level logs the insert ID or rows affected.
type TableCoreConfigData ¶
type TableCoreConfigData struct { ConfigID int64 `db:"config_id" json:",omitempty"` // config_id int(10) unsigned NOT NULL PRI auto_increment Scope string `db:"scope" json:",omitempty"` // scope varchar(8) NOT NULL MUL DEFAULT 'default' ScopeID int64 `db:"scope_id" json:",omitempty"` // scope_id int(11) NOT NULL DEFAULT '0' Path string `db:"path" json:",omitempty"` // path varchar(255) NOT NULL DEFAULT 'general' Value null.String `db:"value" json:",omitempty"` // value text NULL }
TableCoreConfigData represents a type for DB table core_config_data Generated via tableToStruct.
type TableCoreConfigDataSlice ¶
type TableCoreConfigDataSlice []*TableCoreConfigData
TableCoreConfigDataSlice represents a collection type for DB table core_config_data Generated via tableToStruct.