Documentation
¶
Index ¶
- Variables
- type ConfigManager
- func (cm *ConfigManager) ApplyTo(g gonfig.Configer, ow bool) error
- func (cm *ConfigManager) Controls() []Control
- func (s *ConfigManager) Init(ctx context.Context) error
- func (cm *ConfigManager) Params() []Param
- func (cm *ConfigManager) Sections() []Section
- func (s *ConfigManager) Start(ctx context.Context) error
- func (cm *ConfigManager) UpdateParams(m map[string]string, userFingerPrint int64) error
- type Control
- type Param
- type Section
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TableNameParam holds default table name used as params/values storage. TableNameParam = "config_params" // TableNameSection holds default table name holding heirarchy of parameters. TableNameSection = "config_sections" // TableNameControl holds default table name holding ui control names. TableNameControl = "config_controls" // Mapping holds mapping between gonfig kinds and params.data_type_id. Mapping = map[string]gonfig.AKind{ "int": gonfig.AInt, "bool": gonfig.ABool, "string": gonfig.AString, "float": gonfig.AFloat, } )
View Source
var ErrUnsupportedDataType = errors.New("column data_type_id has unknown value")
ErrUnsupportedDataType indicates invalid element in Mapping.
Functions ¶
This section is empty.
Types ¶
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager implements logic or reading application parameters from the sql database.
func (*ConfigManager) ApplyTo ¶
func (cm *ConfigManager) ApplyTo(g gonfig.Configer, ow bool) error
ApplyTo copies all rows from table TableNameParam.
func (*ConfigManager) Controls ¶
func (cm *ConfigManager) Controls() []Control
func (*ConfigManager) Init ¶
func (s *ConfigManager) Init(ctx context.Context) error
Init caches rows from config_* tables.
func (*ConfigManager) Params ¶
func (cm *ConfigManager) Params() []Param
func (*ConfigManager) Sections ¶
func (cm *ConfigManager) Sections() []Section
func (*ConfigManager) UpdateParams ¶
func (cm *ConfigManager) UpdateParams(m map[string]string, userFingerPrint int64) error
type Control ¶
type Control struct {
ID string `json:"id"`
ValidationFunction *string `json:"validateFunction"`
FailedValidationResponse *string `json:"failedValidationResponse"`
}
Control specify ui control to be used for param's value modification.
type Param ¶
type Param struct {
ID string `json:"id"`
SectionID string `json:"sectionID"`
PositionOrder int `json:"positionOrder"`
Name string `json:"name"`
DataTypeID string `json:"dataTypeID"`
ControlID *string `json:"controlID"`
RawValue string `json:"rawValue"`
IsReadonly bool `json:"isReadonly"`
IsSensitive bool `json:"-"`
IsNullable bool `json:"isNullable"`
UpdatedAt time.Time `json:"-"`
UpdateFingerPrint int `json:"-"`
}
Param describes param stored in SQL database. Param's value is stored as string in RawValue field.
Click to show internal directories.
Click to hide internal directories.
