utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0, MIT Imports: 6 Imported by: 40

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssureBoolValue

func AssureBoolValue(mod bool, old bool, value bool) (bool, bool)

func AssureInt64PtrPtr

func AssureInt64PtrPtr(mod bool, old *int64, ptr *int64) (*int64, bool)

func AssureInt64PtrValue

func AssureInt64PtrValue(mod bool, old *int64, value int64) (*int64, bool)

func AssureInt64Value

func AssureInt64Value(mod bool, old int64, value int64) (int64, bool)

func AssureIntPtrValue

func AssureIntPtrValue(mod bool, old *int, value int) (*int, bool)

func AssureIntValue

func AssureIntValue(mod bool, old int, value int) (int, bool)

func AssureStringPtrPtr

func AssureStringPtrPtr(mod bool, old *string, ptr *string) (*string, bool)

func AssureStringPtrValue

func AssureStringPtrValue(mod bool, old *string, value string) (*string, bool)

func AssureStringSet

func AssureStringSet(mod bool, old []string, value StringSet) ([]string, bool)

func AssureStringValue

func AssureStringValue(mod bool, old string, value string) (string, bool)

func Error added in v0.2.0

func Error(args ...interface{}) error

func FillStringValue

func FillStringValue(msg string, variable *string, value string) error

func FirstValue added in v0.2.0

func FirstValue(args ...interface{}) interface{}

func GetValue added in v0.2.0

func GetValue(f reflect.Value) interface{}

func GlobMatcher

func GlobMatcher(s, p interface{}) bool

func Int64Equal

func Int64Equal(a, b *int64) bool

func Int64Value

func Int64Value(v *int64, def int64) int64

func IntEqual

func IntEqual(a, b *int) bool

func IsEmptyString

func IsEmptyString(s *string) bool

func IsNil

func IsNil(o interface{}) bool

func Match

func Match(s, p []interface{}, star interface{}, match func(interface{}, interface{}) bool) bool

func Must added in v0.2.0

func Must(args ...interface{})

Must panics on non-nil errors. Useful to handling programmer level errors.

func RuneMatcher

func RuneMatcher(s, p interface{}) bool

func Runes

func Runes(s string) (runes []interface{})

func SetValue

func SetValue(f reflect.Value, v interface{}) error

func StringArrayAddUnique added in v0.2.0

func StringArrayAddUnique(array *[]string, values ...string) []string

func StringEqual

func StringEqual(a, b *string) bool

func StringKeyArray added in v0.2.0

func StringKeyArray(anystringkeymap interface{}) []string

func StringValue

func StringValue(s *string) string

func Strings

func Strings(s ...string) string

func TypeKey

func TypeKey(v interface{}) (reflect.Type, error)

Types

type Matcher

type Matcher interface {
	Match(s string) bool
	String() string
}

func NewPathGlobMatcher

func NewPathGlobMatcher(pattern string) Matcher

func NewStringGlobMatcher

func NewStringGlobMatcher(pattern string) Matcher

func NewStringMatcher

func NewStringMatcher(s string) Matcher

type ModificationState

type ModificationState struct {
	Modified bool
}

func (*ModificationState) AssureBoolValue

func (this *ModificationState) AssureBoolValue(dst *bool, val bool) *ModificationState

func (*ModificationState) AssureInt64PtrPtr

func (this *ModificationState) AssureInt64PtrPtr(dst **int64, ptr *int64) *ModificationState

func (*ModificationState) AssureInt64PtrValue

func (this *ModificationState) AssureInt64PtrValue(dst **int64, val int64) *ModificationState

func (*ModificationState) AssureInt64Value

func (this *ModificationState) AssureInt64Value(dst *int64, val int64) *ModificationState

func (*ModificationState) AssureIntPtrValue

func (this *ModificationState) AssureIntPtrValue(dst **int, val int) *ModificationState

func (*ModificationState) AssureIntValue

func (this *ModificationState) AssureIntValue(dst *int, val int) *ModificationState

func (*ModificationState) AssureStringPtrPtr

func (this *ModificationState) AssureStringPtrPtr(dst **string, ptr *string) *ModificationState

func (*ModificationState) AssureStringPtrValue

func (this *ModificationState) AssureStringPtrValue(dst **string, val string) *ModificationState

func (*ModificationState) AssureStringSet

func (this *ModificationState) AssureStringSet(dst *[]string, val StringSet) *ModificationState

func (*ModificationState) AssureStringValue

func (this *ModificationState) AssureStringValue(dst *string, val string) *ModificationState

func (*ModificationState) IsModified

func (this *ModificationState) IsModified() bool

func (*ModificationState) Modify

func (this *ModificationState) Modify(m bool) *ModificationState

func (*ModificationState) OnModified

func (this *ModificationState) OnModified(f func() error) error

type Properties

type Properties map[string]string

func (Properties) Copy

func (this Properties) Copy() Properties

func (Properties) Equals

func (this Properties) Equals(t map[string]string) bool

func (Properties) Has

func (this Properties) Has(k string) bool

func (Properties) Keys

func (this Properties) Keys() StringSet

type RateLimiter added in v0.2.0

type RateLimiter interface {
	Succeeded()
	Failed()
	RateLimit() time.Duration
}

func NewDefaultRateLimiter added in v0.2.0

func NewDefaultRateLimiter(min, max time.Duration) RateLimiter

func NewRateLimiter added in v0.2.0

func NewRateLimiter(min, max, minincr time.Duration, factor float64) RateLimiter

type StringMatcher added in v0.2.0

type StringMatcher string

func (StringMatcher) Match added in v0.2.0

func (this StringMatcher) Match(s string) bool

func (StringMatcher) String added in v0.2.0

func (this StringMatcher) String() string

type StringSet

type StringSet map[string]struct{}

func NewStringSet

func NewStringSet(a ...string) StringSet

func NewStringSetByArray

func NewStringSetByArray(a []string) StringSet

func NewStringSetBySets

func NewStringSetBySets(sets ...StringSet) StringSet

func StringKeySet added in v0.2.0

func StringKeySet(anystringkeymap interface{}) StringSet

func StringValueSet added in v0.2.0

func StringValueSet(anystringvaluemap interface{}) StringSet

func (StringSet) Add

func (this StringSet) Add(n ...string) StringSet

func (StringSet) AddAll

func (this StringSet) AddAll(n []string) StringSet

func (StringSet) AddAllSplitted

func (this StringSet) AddAllSplitted(n string) StringSet

func (StringSet) AddSet

func (this StringSet) AddSet(sets ...StringSet) StringSet

func (StringSet) AsArray

func (this StringSet) AsArray() []string

func (StringSet) Clear

func (this StringSet) Clear()

func (StringSet) Contains

func (this StringSet) Contains(n string) bool

func (StringSet) Copy

func (this StringSet) Copy() StringSet

func (StringSet) DiffFrom

func (this StringSet) DiffFrom(set StringSet) (add, del StringSet)

func (StringSet) Equals

func (this StringSet) Equals(set StringSet) bool

func (StringSet) Intersect added in v0.2.0

func (this StringSet) Intersect(o StringSet) StringSet

func (StringSet) IsEmpty added in v0.2.0

func (this StringSet) IsEmpty() bool

func (StringSet) Remove

func (this StringSet) Remove(n ...string) StringSet

func (StringSet) RemoveSet added in v0.2.0

func (this StringSet) RemoveSet(sets ...StringSet) StringSet

func (StringSet) String

func (this StringSet) String() string

type StringStack added in v0.2.0

type StringStack []string

func (StringStack) Empty added in v0.2.0

func (this StringStack) Empty() bool

func (StringStack) Peek added in v0.2.0

func (this StringStack) Peek() string

func (*StringStack) Pop added in v0.2.0

func (this *StringStack) Pop() string

func (*StringStack) Push added in v0.2.0

func (this *StringStack) Push(name string)

func (StringStack) Size added in v0.2.0

func (this StringStack) Size() int

type Versioned

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

Versioned maintains a set of provided object versions and yields the best such version for given required version.

func NewVersioned

func NewVersioned(proto interface{}) *Versioned

func (*Versioned) GetDefault added in v0.2.0

func (this *Versioned) GetDefault() interface{}

func (*Versioned) GetFor

func (this *Versioned) GetFor(req *semver.Version) interface{}

func (*Versioned) GetVersions added in v0.2.0

func (this *Versioned) GetVersions() map[*semver.Version]interface{}

func (*Versioned) MustRegisterVersion

func (this *Versioned) MustRegisterVersion(v *semver.Version, obj interface{})

func (*Versioned) RegisterVersion

func (this *Versioned) RegisterVersion(v *semver.Version, obj interface{}) error

func (*Versioned) SetDefault

func (this *Versioned) SetDefault(obj interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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