Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DelimiterDot sets the delimiter used for determining key parts. DelimiterDot = "." // CfgDelimiterPlaceholder sets the delimiter used for determining key parts. // // In order to verify a configuration file, the configuration file is converted to a UnstructuredObject. // When there is a special character '.' in the parameter will cause the parameter of the configuration file parsing to be messed up. // e.g. pg parameters: auto_explain.log_analyze = 'True' // To solve this problem, the CfgDelimiterPlaceholder variable is introduced to ensure that no such string exists in a configuration file. CfgDelimiterPlaceholder = "@#@" )
Variables ¶
View Source
var (
ConfigRegistryOnce sync.Once
)
Functions ¶
func ContainerEscapeString ¶
Types ¶
type ConfigObject ¶
type ConfigObject interface { // Update sets the value for the key in ConfigObject Update(key string, value any) error // RemoveKey configuration parameter RemoveKey(key string) error // Get returns an interface. Get(key string) interface{} // GetString returns the value associated with the key as a string GetString(key string) (string, error) // GetAllParameters returns all config params as a map[string]interface{} GetAllParameters() map[string]interface{} // SubConfig returns new Sub ConfigObject instance. SubConfig(key string) ConfigObject // Marshal outputs the ConfigObject to string Marshal() (string, error) // Unmarshal reads a string and returns the valid key/value pair of valid variables. Unmarshal(str string) error }
func LoadConfig ¶
func LoadConfig(name string, content string, format appsv1alpha1.CfgFileFormat) (ConfigObject, error)
type ConfigObjectCreator ¶
type ConfigObjectCreator = func(name string) ConfigObject
type ConfigObjectRegistry ¶
type ConfigObjectRegistry struct {
// contains filtered or unexported fields
}
func CfgObjectRegistry ¶
func CfgObjectRegistry() *ConfigObjectRegistry
func (*ConfigObjectRegistry) GetConfigObject ¶
func (c *ConfigObjectRegistry) GetConfigObject(name string, format appsv1alpha1.CfgFileFormat) (ConfigObject, error)
func (*ConfigObjectRegistry) RegisterConfigCreator ¶
func (c *ConfigObjectRegistry) RegisterConfigCreator(format appsv1alpha1.CfgFileFormat, creator ConfigObjectCreator)
Click to show internal directories.
Click to hide internal directories.