config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sep = "."
)

Variables

View Source
var ErrInvalid = errors.New("invalid")
View Source
var ErrNotFound = errors.New("not found")

Functions

func NewPathWith

func NewPathWith(elems ...string) string

NewPath returns a new path with the specified elements.

Types

type Config

type Config interface {
	// UseConfigFile uses the specified file as the configuration.
	UsedConfigFile() string
	// GetConfigObject returns a object value for the specified path.
	GetConfigObject(paths ...string) (any, error)
	// GetConfigString returns a string value for the specified path.
	GetConfigString(paths ...string) (string, error)
	// GetConfigInt returns an integer value for the specified path.
	GetConfigInt(paths ...string) (int, error)
	// GetConfigBool returns a boolean value for the specified path.
	GetConfigBool(paths ...string) (bool, error)
	// UnmarshallConfig unmarshalls the specified path object to the specified object.
	UnmarshallConfig(paths []string, v any) error
	// SetConfigObject sets a object value to the specified path.
	SetConfigObject(paths []string, v any) error
	// SetConfigString sets a string value to the specified path.
	SetConfigString(paths []string, v string) error
	// SetConfigInt sets an integer value to the specified path.
	SetConfigInt(paths []string, v int) error
	// String returns a string representation of the configuration.
	String() string
}

Config represents a configuration interface.

func NewConfigWith

func NewConfigWith(productName string) Config

NewConfigWith creates a new configuration with the specified product name.

Jump to

Keyboard shortcuts

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