typcfg

package
v0.9.51 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load added in v0.9.48

func Load(source string) (m map[string]string, err error)

Load configuration from source file

func Process added in v0.9.48

func Process(name string, spec interface{}) error

Process populates the specified struct based on environment variables

func Read added in v0.9.48

func Read(r io.Reader) (m map[string]string)

Read config file

func Write added in v0.9.48

func Write(dest string, c Config) (err error)

Write configuration to file

Types

type Config added in v0.9.51

type Config interface {
	Configurations() []*Configuration
}

Config responsible to create config

type Configs added in v0.9.51

type Configs []Config

Configs is list of Configurer

func (Configs) Configurations added in v0.9.51

func (c Configs) Configurations() (cfgs []*Configuration)

Configurations of configurer

type Configuration

type Configuration struct {
	CtorName string
	Name     string
	Spec     interface{}
}

Configuration is alias from typgo.Configuration with Configurer implementation

func (*Configuration) Configurations added in v0.9.48

func (c *Configuration) Configurations() []*Configuration

Configurations of configuration instance

type Field

type Field struct {
	Name     string
	Type     string
	Default  string
	Value    interface{}
	IsZero   bool
	Required bool
}

Field of config

func CreateFields added in v0.9.51

func CreateFields(c *Configuration) (fields []*Field)

CreateFields to retrieve fields from configuration

func (*Field) GetValue added in v0.9.48

func (f *Field) GetValue() interface{}

GetValue to get value or default value if no value

Jump to

Keyboard shortcuts

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