lib

package
v0.0.0-...-c02b23a Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsurePath

func EnsurePath(path string, dir bool) error

EnsurePath is used to make sure a path exists

func GetPrivateIP

func GetPrivateIP() (net.IP, error)

GetPrivateIP is used to return the first private IP address associated with an interface on the machine

func GetPublicIPv6

func GetPublicIPv6() (net.IP, error)

GetPublicIPv6 is used to return the first public IP address associated with an interface on the machine

Types

type ListOpts

type ListOpts struct {
	// contains filtered or unexported fields
}

ListOpts holds a list of values and a validation function.

func NewListOpts

func NewListOpts(validator ValidatorFctType) ListOpts

NewListOpts creates a new ListOpts with the specified validator.

func NewListOptsRef

func NewListOptsRef(values *[]string, validator ValidatorFctType) *ListOpts

NewListOptsRef creates a new ListOpts with the specified values and validator.

func (*ListOpts) Delete

func (opts *ListOpts) Delete(key string)

Delete removes the specified element from the slice.

func (*ListOpts) Get

func (opts *ListOpts) Get(key string) bool

Get checks the existence of the specified key.

func (*ListOpts) GetAll

func (opts *ListOpts) GetAll() []string

GetAll returns the values of slice.

func (*ListOpts) GetAllOrEmpty

func (opts *ListOpts) GetAllOrEmpty() []string

GetAllOrEmpty returns the values of the slice or an empty slice when there are no values.

func (*ListOpts) GetMap

func (opts *ListOpts) GetMap() map[string]struct{}

GetMap returns the content of values in a map in order to avoid duplicates.

func (*ListOpts) Len

func (opts *ListOpts) Len() int

Len returns the amount of element in the slice.

func (*ListOpts) Set

func (opts *ListOpts) Set(value string) error

Set validates if needed the input value and adds it to the internal slice.

func (*ListOpts) String

func (opts *ListOpts) String() string

func (*ListOpts) Type

func (opts *ListOpts) Type() string

Type returns a string name for this Option type

func (*ListOpts) WithValidator

func (opts *ListOpts) WithValidator(validator ValidatorFctType) *ListOpts

WithValidator returns the ListOpts with validator set.

type ValidatorFctType

type ValidatorFctType func(val string) (string, error)

ValidatorFctType defines a validator function that returns a validated string and/or an error.

Jump to

Keyboard shortcuts

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