opts

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Concrete

type Concrete struct {
	Bool     func() bool
	Duration func() time.Duration
	Float    func() float64
	Integer  func() int64
	List     func() []string
	Text     func() string
}

Concrete is a struct of functions that return the concrete values. Only the intended type will return a value, the rest always return zero.

Note there is no meta.Text type because this can be had using the Option.String method below in all cases.

func NewConcrete

func NewConcrete() Concrete

NewConcrete provides a Concrete with all functions returning zero values

type Config

type Config map[string]map[string]Option

func (Config) MarshalText

func (c Config) MarshalText() (b []byte, e error)

MarshalText produces a standard TOML format document via toml.Marshal that can be used to toml.UnmarshalTOML back into the Config.

type Option

type Option interface {
	FromString(s string) (e error)
	String() (s string)
	Value() (c Concrete)
	Type() (t meta.Type)
	Meta() (md meta.Metadata)
}

Option interface reads and writes string formats for options and returns a Concrete value to the appropriate concrete value, with the type indicated.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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