unstructured

package
v0.8.0-beta.27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2023 License: AGPL-3.0 Imports: 19 Imported by: 1

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

func ContainerEscapeString(v string) bool

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)

type Item

type Item struct {
	LineNo   int
	Comments []string
	Values   []string
}

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func (*Lexer) Load

func (l *Lexer) Load(str string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL