yaml

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoConfig

type AutoConfig struct {
	FName string `yaml:"filename"` // Filename of the YAML configuration file.
}

AutoConfig represents the configuration for the YAML file.

type Data

type Data struct {
	Engine []map[string]interface{} `yaml:"engine"` // Engine configurations.
	Cfg    map[string]interface{}   `yaml:"cfg"`    // General configurations.
}

Data represents the structure of the YAML data.

type Yaml

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

Yaml handles the loading and parsing of YAML configuration files.

func New

func New(cfg AutoConfig) *Yaml

New creates a new Yaml instance with the given configuration.

func (*Yaml) GetBool

func (t *Yaml) GetBool(key string, def bool) bool

GetBool returns the boolean value for the given key, or the default value if the key does not exist.

func (*Yaml) GetConfigItem

func (t *Yaml) GetConfigItem(typeName string, name string) map[string]interface{}

GetConfigItem returns the configuration item for the given type and name.

func (*Yaml) GetFloat

func (t *Yaml) GetFloat(key string, def float64) float64

GetFloat returns the float64 value for the given key, or the default value if the key does not exist.

func (*Yaml) GetInt

func (t *Yaml) GetInt(key string, def int) int

GetInt returns the integer value for the given key, or the default value if the key does not exist.

func (*Yaml) GetMapBool

func (t *Yaml) GetMapBool(key string, def map[string]bool) map[string]bool

GetMapBool returns the map[string]bool value for the given key, or the default value if the key does not exist.

func (*Yaml) GetMapFloat

func (t *Yaml) GetMapFloat(key string, def map[string]float64) map[string]float64

GetMapFloat returns the map[string]float64 value for the given key, or the default value if the key does not exist.

func (*Yaml) GetMapInt

func (t *Yaml) GetMapInt(key string, def map[string]int) map[string]int

GetMapInt returns the map[string]int value for the given key, or the default value if the key does not exist.

func (*Yaml) GetMapInterface

func (t *Yaml) GetMapInterface(key string, def map[string]interface{}) map[string]interface{}

GetMapInterface returns the map[string]interface{} value for the given key, or the default value if the key does not exist.

func (*Yaml) GetMapString

func (t *Yaml) GetMapString(key string, def map[string]string) map[string]string

GetMapString returns the map[string]string value for the given key, or the default value if the key does not exist.

func (*Yaml) GetSliceBool

func (t *Yaml) GetSliceBool(key string, def []bool) []bool

GetSliceBool returns the []bool value for the given key, or the default value if the key does not exist.

func (*Yaml) GetSliceFloat

func (t *Yaml) GetSliceFloat(key string, def []float64) []float64

GetSliceFloat returns the []float64 value for the given key, or the default value if the key does not exist.

func (*Yaml) GetSliceInt

func (t *Yaml) GetSliceInt(key string, def []int) []int

GetSliceInt returns the []int value for the given key, or the default value if the key does not exist.

func (*Yaml) GetSliceInterface

func (t *Yaml) GetSliceInterface(key string, def []interface{}) []interface{}

GetSliceInterface returns the []interface{} value for the given key, or the default value if the key does not exist.

func (*Yaml) GetSliceString

func (t *Yaml) GetSliceString(key string, def []string) []string

GetSliceString returns the []string value for the given key, or the default value if the key does not exist.

func (*Yaml) GetString

func (t *Yaml) GetString(key string, def string) string

GetString returns the string value for the given key, or the default value if the key does not exist.

func (*Yaml) Has

func (t *Yaml) Has(key string) bool

Has checks if the given key exists in the configuration.

func (*Yaml) Init

func (t *Yaml) Init(app interfaces.IEngine) error

Init initializes the YAML configuration by loading the file.

func (*Yaml) Stop

func (t *Yaml) Stop() error

Stop stops the YAML configuration handler.

Jump to

Keyboard shortcuts

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