types

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Names = []string{
	"Bool",
	"Int",
	"Uint",
	"Duration",
	"Float",
	"String",
	"List",
}

Names provides the string associated with the Concrete type.

Functions

func Name

func Name(T Type) string

Name is a helper that returns the name associated with a Type.

Types

type Concrete

type Concrete interface {
	Bool() bool
	Int() int64
	Uint() uint64
	Duration() time.Duration
	Float() float64
	String() string
	List() []string
}

Concrete should return a value for the correct concrete type and panic otherwise, except for String which should always yield a value.

type Desc added in v0.1.6

type Desc struct {
	Name, Group, Description, Documentation, Default string
	Type                                             Type
	Tags, Aliases                                    []string
}

Desc is the named field form of Metadata for generating a Metadata

type Item

type Item interface {
	Name() string
	Type() Type
	Aliases() []string
	Group() string
	Tags() []string
	Description() string
	Documentation() string
	Default() string
	FromString(string) error
	Meta() *Metadata
	Concrete
}

Item provides accessors for a Config item type's metadata and current contents, including a generic string format setter.

type Metadata added in v0.1.6

type Metadata struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Metadata stores the information about the types.Item for documentation purposes

func New added in v0.1.6

func New(args Desc) *Metadata

New allows you to create a Metadata with a sparsely filled, named field struct literal.

name, type, group and tags all will be canonicalized to lower case.

func (*Metadata) Aliases added in v0.1.6

func (m *Metadata) Aliases() []string

func (*Metadata) Default added in v0.1.6

func (m *Metadata) Default() string

func (*Metadata) Description added in v0.1.6

func (m *Metadata) Description() string

func (*Metadata) Documentation added in v0.1.6

func (m *Metadata) Documentation() string

func (*Metadata) Group added in v0.1.6

func (m *Metadata) Group() string

func (*Metadata) Name added in v0.1.6

func (m *Metadata) Name() string

func (*Metadata) Tags added in v0.1.6

func (m *Metadata) Tags() []string

func (*Metadata) Type added in v0.1.6

func (m *Metadata) Type() Type

type Type

type Type int

Type is an identifier code for a type of configuration item.

const (
	Bool Type = iota
	Int
	Uint
	Duration
	Float
	String
	List
)

The list of types.Item supported by proc

func (Type) String added in v0.1.6

func (t Type) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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