key

package
v0.0.0-...-9a46783 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortedKeys

func SortedKeys(m map[string]interface{}) []string

SortedKeys returns the keys of the given map, in a sorted order.

func StringifyCollection

func StringifyCollection(m map[Key]interface{}) string

StringifyCollection safely returns a string representation of a map[Key]interface{} that is similar in form to the standard stringification of a map, "map[k1:v1, k2:v2]". This differs from StringifyInterface's handling of a map which emits a string to be used as key in contexts such as JSON objects.

func StringifyInterface

func StringifyInterface(key interface{}) (string, error)

StringifyInterface transforms an arbitrary interface into its string representation. We need to do this because some entities use the string representation of their keys as their names. Note: this API is deprecated and will be removed.

Types

type Comparable

type Comparable interface {
	// Equal returns true if this object is equal to the other one.
	Equal(other interface{}) bool
}

Comparable types have an equality-testing method.

type Key

type Key interface {
	Key() interface{}
	String() string
	Equal(other interface{}) bool
}

Key represents the Key in the updates and deletes of the Notification objects. The only reason this exists is that Go won't let us define our own hash function for non-hashable types, and unfortunately we need to be able to index maps by map[string]interface{} objects and slices by []interface{} objects.

func New

func New(intf interface{}) Key

New wraps the given value in a Key. This function panics if the value passed in isn't allowed in a Key or doesn't implement value.Value.

type Path

type Path []Key

Path represents a path decomposed into elements where each element is a Key. A Path can be interpreted as either absolute or relative depending on how it is used.

func (Path) Equal

func (p Path) Equal(other interface{}) bool

Equal returns whether a Path is equal to @other.

func (Path) MarshalJSON

func (p Path) MarshalJSON() ([]byte, error)

MarshalJSON marshals a Path to JSON.

func (Path) String

func (p Path) String() string

String returns the Path as an absolute path string.

type Pointer

type Pointer interface {
	Pointer() Path
}

Pointer is a pointer to a path.

func NewPointer

func NewPointer(path Path) Pointer

NewPointer creates a new pointer to a path.

Jump to

Keyboard shortcuts

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