orderedmap: gomodules.xyz/orderedmap Index | Files

package orderedmap

import "gomodules.xyz/orderedmap"

Index

Package Files

helpers.go orderedmap.go

Variables

var NoValueError = errors.New("No value for this key")

func DeepCopyJSONValue Uses

func DeepCopyJSONValue(x interface{}) interface{}

DeepCopyJSONValue deep copies the passed value, assuming it is a valid JSON representation i.e. only contains types produced by json.Unmarshal() and also int64. bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil

func NestedBool Uses

func NestedBool(obj *OrderedMap, fields ...string) (bool, bool, error)

NestedBool returns the bool value of a nested field. Returns false if value is not found and an error if not a bool.

func NestedFieldCopy Uses

func NestedFieldCopy(obj *OrderedMap, fields ...string) (interface{}, bool, error)

NestedFieldCopy returns a deep copy of the value of a nested field. Returns false if the value is missing. No error is returned for a nil field.

Note: fields passed to this function are treated as keys within the passed object; no array/slice syntax is supported.

func NestedFieldNoCopy Uses

func NestedFieldNoCopy(obj *OrderedMap, fields ...string) (interface{}, bool, error)

NestedFieldNoCopy returns a reference to a nested field. Returns false if value is not found and an error if unable to traverse obj.

Note: fields passed to this function are treated as keys within the passed object; no array/slice syntax is supported.

func NestedFloat64 Uses

func NestedFloat64(obj *OrderedMap, fields ...string) (float64, bool, error)

NestedFloat64 returns the float64 value of a nested field. Returns false if value is not found and an error if not a float64.

func NestedInt64 Uses

func NestedInt64(obj *OrderedMap, fields ...string) (int64, bool, error)

NestedInt64 returns the int64 value of a nested field. Returns false if value is not found and an error if not an int64.

func NestedSlice Uses

func NestedSlice(obj *OrderedMap, fields ...string) ([]interface{}, bool, error)

NestedSlice returns a deep copy of []interface{} value of a nested field. Returns false if value is not found and an error if not a []interface{}.

func NestedString Uses

func NestedString(obj *OrderedMap, fields ...string) (string, bool, error)

NestedString returns the string value of a nested field. Returns false if value is not found and an error if not a string.

func NestedStringMap Uses

func NestedStringMap(obj *OrderedMap, fields ...string) (map[string]string, bool, error)

NestedStringMap returns a copy of map[string]string value of a nested field. Returns false if value is not found and an error if not a OrderedMap or contains non-string values in the map.

func NestedStringSlice Uses

func NestedStringSlice(obj *OrderedMap, fields ...string) ([]string, bool, error)

NestedStringSlice returns a copy of []string value of a nested field. Returns false if value is not found and an error if not a []interface{} or contains non-string items in the slice.

func RemoveNestedField Uses

func RemoveNestedField(obj *OrderedMap, fields ...string)

RemoveNestedField removes the nested field from the obj.

func SetNestedField Uses

func SetNestedField(obj *OrderedMap, value interface{}, fields ...string) error

SetNestedField sets the value of a nested field to a deep copy of the value provided. Returns an error if value cannot be set because one of the nesting levels is not a OrderedMap.

func SetNestedMap Uses

func SetNestedMap(obj *OrderedMap, value OrderedMap, fields ...string) error

SetNestedMap sets the OrderedMap value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a OrderedMap.

func SetNestedSlice Uses

func SetNestedSlice(obj *OrderedMap, value []interface{}, fields ...string) error

SetNestedSlice sets the slice value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a OrderedMap.

func SetNestedStringMap Uses

func SetNestedStringMap(obj *OrderedMap, value map[string]string, fields ...string) error

SetNestedStringMap sets the map[string]string value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a OrderedMap.

func SetNestedStringSlice Uses

func SetNestedStringSlice(obj *OrderedMap, value []string, fields ...string) error

SetNestedStringSlice sets the string slice value of a nested field. Returns an error if value cannot be set because one of the nesting levels is not a OrderedMap.

type ByIndex Uses

type ByIndex []KeyIndex

func (ByIndex) Len Uses

func (a ByIndex) Len() int

func (ByIndex) Less Uses

func (a ByIndex) Less(i, j int) bool

func (ByIndex) Swap Uses

func (a ByIndex) Swap(i, j int)

type ByPair Uses

type ByPair struct {
    Pairs    []*Pair
    LessFunc func(a *Pair, j *Pair) bool
}

func (ByPair) Len Uses

func (a ByPair) Len() int

func (ByPair) Less Uses

func (a ByPair) Less(i, j int) bool

func (ByPair) Swap Uses

func (a ByPair) Swap(i, j int)

type KeyIndex Uses

type KeyIndex struct {
    Key   string
    Index int
}

type OrderedMap Uses

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

func DeepCopyJSON Uses

func DeepCopyJSON(x *OrderedMap) *OrderedMap

DeepCopyJSON deep copies the passed value, assuming it is a valid JSON representation i.e. only contains types produced by json.Unmarshal() and also int64. bool, int64, float64, string, []interface{}, map[string]interface{}, json.Number and nil

func NestedMap Uses

func NestedMap(obj *OrderedMap, fields ...string) (*OrderedMap, bool, error)

NestedMap returns a deep copy of OrderedMap value of a nested field. Returns false if value is not found and an error if not a OrderedMap.

func New Uses

func New() *OrderedMap

func (*OrderedMap) DeepCopy Uses

func (o *OrderedMap) DeepCopy() *OrderedMap

DeepCopy is a deepcopy function, copying the receiver, creating a new OrderedMap.

func (*OrderedMap) DeepCopyInto Uses

func (o *OrderedMap) DeepCopyInto(out *OrderedMap)

DeepCopyInto is a deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*OrderedMap) Delete Uses

func (o *OrderedMap) Delete(key string)

func (*OrderedMap) Entry Uses

func (o *OrderedMap) Entry(key string) interface{}

func (*OrderedMap) Get Uses

func (o *OrderedMap) Get(key string) (interface{}, bool)

func (*OrderedMap) IsZero Uses

func (o *OrderedMap) IsZero() bool

IsZero returns true if the value is nil or OrderedMap is zero.

func (*OrderedMap) Keys Uses

func (o *OrderedMap) Keys() []string

func (*OrderedMap) Len Uses

func (o *OrderedMap) Len() int

func (OrderedMap) MarshalJSON Uses

func (o OrderedMap) MarshalJSON() ([]byte, error)

func (*OrderedMap) Set Uses

func (o *OrderedMap) Set(key string, value interface{})

func (*OrderedMap) Sort Uses

func (o *OrderedMap) Sort(lessFunc func(a *Pair, b *Pair) bool)

Sort Sort the map using your sort func

func (*OrderedMap) SortKeys Uses

func (o *OrderedMap) SortKeys(sortFunc func(keys []string))

SortKeys Sort the map keys using your sort func

func (*OrderedMap) UnmarshalJSON Uses

func (o *OrderedMap) UnmarshalJSON(b []byte) error

type Pair Uses

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

func (*Pair) Key Uses

func (kv *Pair) Key() string

func (*Pair) Value Uses

func (kv *Pair) Value() interface{}

Package orderedmap imports 5 packages (graph) and is imported by 1 packages. Updated 2020-04-03. Refresh now. Tools for package owners.