generic

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map interface {
	IsSet(key interface{}) bool
	Set(key, value interface{})
	Get(key interface{}) Value
	Sub(key interface{}) Map
	Delete(key interface{})
	DeleteAll(keys ...interface{})
	Copy() Map
	With(keys ...interface{}) Map
	Without(keys ...interface{}) Map
	Values() interface{}
	Keys() interface{}
	Map() map[string]interface{}
	ForEach(func(key, value interface{}))
}

Map provides a map wrapper interface for working easily with unknown map types

func MakeMap

func MakeMap(m interface{}) Map

MakeMap returns a Mapper from the passed map

func ParseEnv

func ParseEnv() Map

ParseEnv retuns the environment as a params

func ParseString

func ParseString(s string) Map

ParseString parses a mapping string and returns a params object Example string: foo=bar aparam="value"

type MapFilter

type MapFilter func(index int, val interface{}) (string, interface{}, bool)

MapFilter returns true and the key and value, or false if the value should be skipped

type Slice

type Slice interface {
	Append(vals ...interface{}) Slice
	Insert(index int, val interface{}) Slice
	IndexOf(val interface{}) int
	Len() int
	Get(index int) interface{}
	Remove(index int) Slice
	Filter(func(index int, val interface{}) bool) Slice
	ForEach(func(index int, val interface{}))
	Map(out interface{}, filters ...MapFilter)
	ToMap() Map
	Contains(values ...interface{}) bool
	ContainsAny(values ...interface{}) bool
}

Slice is a generic slice manipulation interface helper

func MakeSlice

func MakeSlice(s interface{}) Slice

MakeSlice returns a slicer object from a slice

type Value

type Value interface {
	String() string
	StringPtr() *string
	StringSlice() []string
	Bool() bool
	Int() int
	Int64() int64
	Uint64() uint64
	Float64() float64
	Slice() []interface{}
	Map() Map
	Duration() time.Duration
	Time() time.Time
	Interface() interface{}
	IsNil() bool
	IsJSONNumber() bool
}

Value defines a simple casting interface

func MakeValue

func MakeValue(v interface{}) Value

MakeValue returns a new value with cast helpers

Jump to

Keyboard shortcuts

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