types

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Unlicense Imports: 7 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 BooT added in v0.1.7

type BooT struct {
	*Metadata
	// contains filtered or unexported fields
}

BooT is a boolean item type

func (BooT) Bool added in v0.1.7

func (b BooT) Bool() bool

func (BooT) Duration added in v0.1.7

func (b BooT) Duration() time.Duration

func (BooT) Float added in v0.1.7

func (b BooT) Float() float64

func (*BooT) FromString added in v0.1.7

func (b *BooT) FromString(s string) error

func (BooT) Int added in v0.1.7

func (b BooT) Int() int64

func (BooT) List added in v0.1.7

func (b BooT) List() []string

func (BooT) Meta added in v0.1.7

func (b BooT) Meta() *Metadata

func (*BooT) Set added in v0.1.7

func (b *BooT) Set(bo bool)

func (BooT) String added in v0.1.7

func (b BooT) String() string

func (BooT) Uint added in v0.1.7

func (b BooT) Uint() uint64

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
	Aliases                                          []string
}

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

type DurT added in v0.1.7

type DurT struct {
	*Metadata
	// contains filtered or unexported fields
}

DurT is a duration item type

func (DurT) Bool added in v0.1.7

func (d DurT) Bool() bool

func (DurT) Duration added in v0.1.7

func (d DurT) Duration() time.Duration

func (DurT) Float added in v0.1.7

func (d DurT) Float() float64

func (*DurT) FromString added in v0.1.7

func (d *DurT) FromString(s string) error

func (DurT) Int added in v0.1.7

func (d DurT) Int() int64

func (DurT) List added in v0.1.7

func (d DurT) List() []string

func (DurT) Meta added in v0.1.7

func (d DurT) Meta() *Metadata

func (*DurT) Set added in v0.1.7

func (d *DurT) Set(du time.Duration)

func (DurT) String added in v0.1.7

func (d DurT) String() string

func (DurT) Uint added in v0.1.7

func (d DurT) Uint() uint64

type FltT added in v0.1.7

type FltT struct {
	*Metadata
	// contains filtered or unexported fields
}

FltT is a float64 item type

func (FltT) Bool added in v0.1.7

func (f FltT) Bool() bool

func (FltT) Duration added in v0.1.7

func (f FltT) Duration() time.Duration

func (FltT) Float added in v0.1.7

func (f FltT) Float() float64

func (*FltT) FromString added in v0.1.7

func (f *FltT) FromString(s string) error

func (FltT) Int added in v0.1.7

func (f FltT) Int() int64

func (FltT) List added in v0.1.7

func (f FltT) List() []string

func (FltT) Meta added in v0.1.7

func (f FltT) Meta() *Metadata

func (*FltT) Set added in v0.1.7

func (f *FltT) Set(fl float64)

func (FltT) String added in v0.1.7

func (f FltT) String() string

func (FltT) Uint added in v0.1.7

func (f FltT) Uint() uint64

type IntT added in v0.1.7

type IntT struct {
	*Metadata
	// contains filtered or unexported fields
}

IntT is an int64 item type

func (IntT) Bool added in v0.1.7

func (in IntT) Bool() bool

func (IntT) Duration added in v0.1.7

func (in IntT) Duration() time.Duration

func (IntT) Float added in v0.1.7

func (in IntT) Float() float64

func (*IntT) FromString added in v0.1.7

func (in *IntT) FromString(s string) error

func (IntT) Int added in v0.1.7

func (in IntT) Int() int64

func (IntT) List added in v0.1.7

func (in IntT) List() []string

func (IntT) Meta added in v0.1.7

func (in IntT) Meta() *Metadata

func (*IntT) Set added in v0.1.7

func (in *IntT) Set(i int64)

func (IntT) String added in v0.1.7

func (in IntT) String() string

func (IntT) Uint added in v0.1.7

func (in IntT) Uint() uint64

type Item

type Item interface {
	Name() string
	Type() Type
	Aliases() []string
	Group() 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 LstT added in v0.1.7

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

LstT is a []string item type

func (LstT) Bool added in v0.1.7

func (l LstT) Bool() bool

func (LstT) Duration added in v0.1.7

func (l LstT) Duration() time.Duration

func (LstT) Float added in v0.1.7

func (l LstT) Float() float64

func (*LstT) FromString added in v0.1.7

func (l *LstT) FromString(s string) error

func (LstT) Int added in v0.1.7

func (l LstT) Int() int64

func (LstT) List added in v0.1.7

func (l LstT) List() (li []string)

func (LstT) Meta added in v0.1.7

func (l LstT) Meta() *Metadata

func (*LstT) Set added in v0.1.7

func (l *LstT) Set(li ...string)

func (LstT) String added in v0.1.7

func (l LstT) String() (o string)

func (LstT) Uint added in v0.1.7

func (l LstT) Uint() uint64

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) Type added in v0.1.6

func (m *Metadata) Type() Type

type StrT added in v0.1.7

type StrT struct {
	*Metadata
	// contains filtered or unexported fields
}

StrT is a string item type

func (StrT) Bool added in v0.1.7

func (s StrT) Bool() bool

func (StrT) Duration added in v0.1.7

func (s StrT) Duration() time.Duration

func (StrT) Float added in v0.1.7

func (s StrT) Float() float64

func (*StrT) FromString added in v0.1.7

func (s *StrT) FromString(st string) error

func (StrT) Int added in v0.1.7

func (s StrT) Int() int64

func (StrT) List added in v0.1.7

func (s StrT) List() []string

func (StrT) Meta added in v0.1.7

func (s StrT) Meta() *Metadata

func (*StrT) Set added in v0.1.7

func (s *StrT) Set(st string)

func (StrT) String added in v0.1.7

func (s StrT) String() string

func (StrT) Uint added in v0.1.7

func (s StrT) Uint() uint64

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

type UinT added in v0.1.7

type UinT struct {
	*Metadata
	// contains filtered or unexported fields
}

UinT is an uint64 item type

func (UinT) Bool added in v0.1.7

func (u UinT) Bool() bool

func (UinT) Duration added in v0.1.7

func (u UinT) Duration() time.Duration

func (UinT) Float added in v0.1.7

func (u UinT) Float() float64

func (*UinT) FromString added in v0.1.7

func (u *UinT) FromString(s string) error

func (UinT) Int added in v0.1.7

func (u UinT) Int() int64

func (UinT) List added in v0.1.7

func (u UinT) List() []string

func (UinT) Meta added in v0.1.7

func (u UinT) Meta() *Metadata

func (*UinT) Set added in v0.1.7

func (u *UinT) Set(ui uint64)

func (UinT) String added in v0.1.7

func (u UinT) String() string

func (UinT) Uint added in v0.1.7

func (u UinT) Uint() uint64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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