ordereddict

package module
v0.0.0-...-2aa49cc Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 141

README

ordereddict

A simple Ordered Dict implementation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAny

func GetAny(event_map *Dict, members string) (interface{}, bool)

func GetInt

func GetInt(event_map *Dict, members string) (int, bool)

func GetString

func GetString(event_map *Dict, members string) (string, bool)

Types

type Dict

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

A concerete implementation of a row - similar to Python's OrderedDict. Main difference is that delete is not implemented - we just preserve the order of insertions.

func GetMap

func GetMap(event_map *Dict, members string) (*Dict, bool)

func NewDict

func NewDict() *Dict

func (*Dict) Delete

func (self *Dict) Delete(key string)

Very inefficient but ok for occasional use.

func (*Dict) Get

func (self *Dict) Get(key string) (interface{}, bool)

func (*Dict) GetBool

func (self *Dict) GetBool(key string) (bool, bool)

func (*Dict) GetDefault

func (self *Dict) GetDefault() interface{}

func (*Dict) GetInt64

func (self *Dict) GetInt64(key string) (int64, bool)

func (*Dict) GetString

func (self *Dict) GetString(key string) (string, bool)

func (*Dict) GetStrings

func (self *Dict) GetStrings(key string) ([]string, bool)

func (*Dict) GoString

func (self *Dict) GoString() string

func (*Dict) IsCaseInsensitive

func (self *Dict) IsCaseInsensitive() bool

func (*Dict) Keys

func (self *Dict) Keys() []string

func (*Dict) Len

func (self *Dict) Len() int

func (*Dict) MarshalJSON

func (self *Dict) MarshalJSON() ([]byte, error)

Preserve key order when marshalling to JSON.

func (*Dict) MarshalYAML

func (self *Dict) MarshalYAML() (interface{}, error)

func (*Dict) MergeFrom

func (self *Dict) MergeFrom(other *Dict)

func (*Dict) Set

func (self *Dict) Set(key string, value interface{}) *Dict

func (*Dict) SetCaseInsensitive

func (self *Dict) SetCaseInsensitive() *Dict

func (*Dict) SetDefault

func (self *Dict) SetDefault(value interface{}) *Dict

func (*Dict) String

func (self *Dict) String() string

Printing the dict will always result in a valid JSON document.

func (*Dict) ToDict

func (self *Dict) ToDict() *map[string]interface{}

func (*Dict) UnmarshalJSON

func (self *Dict) UnmarshalJSON(data []byte) error

this implements type json.Unmarshaler interface, so can be called in json.Unmarshal(data, om). We preserve key order when unmarshaling from JSON.

func (*Dict) UnmarshalYAML

func (self *Dict) UnmarshalYAML(unmarshal func(interface{}) error) error

func (*Dict) Update

func (self *Dict) Update(key string, value interface{}) *Dict

Like Set() but does not effect the order.

Jump to

Keyboard shortcuts

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