types

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 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

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

BooT is a boolean item type

func (BooT) Bool

func (b BooT) Bool() bool

func (BooT) Duration

func (b BooT) Duration() time.Duration

func (BooT) Float

func (b BooT) Float() float64

func (*BooT) FromString

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

func (BooT) Int

func (b BooT) Int() int64

func (BooT) List

func (b BooT) List() []string

func (BooT) Meta

func (b BooT) Meta() *Metadata

func (*BooT) Set

func (b *BooT) Set(bo bool)

func (BooT) String

func (b BooT) String() string

func (BooT) Uint

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

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

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

DurT is a duration item type

func (DurT) Bool

func (d DurT) Bool() bool

func (DurT) Duration

func (d DurT) Duration() time.Duration

func (DurT) Float

func (d DurT) Float() float64

func (*DurT) FromString

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

func (DurT) Int

func (d DurT) Int() int64

func (DurT) List

func (d DurT) List() []string

func (DurT) Meta

func (d DurT) Meta() *Metadata

func (*DurT) Set

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

func (DurT) String

func (d DurT) String() string

func (DurT) Uint

func (d DurT) Uint() uint64

type FltT

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

FltT is a float64 item type

func (FltT) Bool

func (f FltT) Bool() bool

func (FltT) Duration

func (f FltT) Duration() time.Duration

func (FltT) Float

func (f FltT) Float() float64

func (*FltT) FromString

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

func (FltT) Int

func (f FltT) Int() int64

func (FltT) List

func (f FltT) List() []string

func (FltT) Meta

func (f FltT) Meta() *Metadata

func (*FltT) Set

func (f *FltT) Set(fl float64)

func (FltT) String

func (f FltT) String() string

func (FltT) Uint

func (f FltT) Uint() uint64

type IntT

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

IntT is an int64 item type

func (IntT) Bool

func (in IntT) Bool() bool

func (IntT) Duration

func (in IntT) Duration() time.Duration

func (IntT) Float

func (in IntT) Float() float64

func (*IntT) FromString

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

func (IntT) Int

func (in IntT) Int() int64

func (IntT) List

func (in IntT) List() []string

func (IntT) Meta

func (in IntT) Meta() *Metadata

func (*IntT) Set

func (in *IntT) Set(i int64)

func (IntT) String

func (in IntT) String() string

func (IntT) Uint

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

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

LstT is a []string item type

func (LstT) Bool

func (l LstT) Bool() bool

func (LstT) Duration

func (l LstT) Duration() time.Duration

func (LstT) Float

func (l LstT) Float() float64

func (*LstT) FromString

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

func (LstT) Int

func (l LstT) Int() int64

func (LstT) List

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

func (LstT) Meta

func (l LstT) Meta() *Metadata

func (*LstT) Set

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

func (LstT) String

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

func (LstT) Uint

func (l LstT) Uint() uint64

type Metadata

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

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

func New

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

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

func (*Metadata) Default

func (m *Metadata) Default() string

func (*Metadata) Description

func (m *Metadata) Description() string

func (*Metadata) Documentation

func (m *Metadata) Documentation() string

func (*Metadata) Group

func (m *Metadata) Group() string

func (*Metadata) Name

func (m *Metadata) Name() string

func (*Metadata) Type

func (m *Metadata) Type() Type

type StrT

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

StrT is a string item type

func (StrT) Bool

func (s StrT) Bool() bool

func (StrT) Duration

func (s StrT) Duration() time.Duration

func (StrT) Float

func (s StrT) Float() float64

func (*StrT) FromString

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

func (StrT) Int

func (s StrT) Int() int64

func (StrT) List

func (s StrT) List() []string

func (StrT) Meta

func (s StrT) Meta() *Metadata

func (*StrT) Set

func (s *StrT) Set(st string)

func (StrT) String

func (s StrT) String() string

func (StrT) Uint

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

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

UinT is an uint64 item type

func (UinT) Bool

func (u UinT) Bool() bool

func (UinT) Duration

func (u UinT) Duration() time.Duration

func (UinT) Float

func (u UinT) Float() float64

func (*UinT) FromString

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

func (UinT) Int

func (u UinT) Int() int64

func (UinT) List

func (u UinT) List() []string

func (UinT) Meta

func (u UinT) Meta() *Metadata

func (*UinT) Set

func (u *UinT) Set(ui uint64)

func (UinT) String

func (u UinT) String() string

func (UinT) Uint

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