v1.1.0 Latest Latest

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

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 3 Imported by: 1



Package hash implements a kiwi.Value which can store a string-string hashmap.



View Source
const (
	// Insert inserts the key-value pair in hash map.
	// Updates the value if key is already present.
	// Returns the added key string
	Insert kiwi.Action = "INSERT"

	// Remove removes the string(s) from the set.
	// Returns an array of removed key strings.
	Remove kiwi.Action = "REMOVE"

	// Has checks if hash-map has the key.
	// Returns boolean value.
	Has kiwi.Action = "HAS"

	// Len gets the length of the hash map.
	// Returns an integer.
	Len kiwi.Action = "LEN"

	// Get gets the value of the given key(s).
	// Returns an array of values.
	Get kiwi.Action = "GET"

	// Keys gets all the keys from the hash-map.
	// Returns an array of keys.
	Keys kiwi.Action = "KEYS"

	// Map gets a copy of hash-map.
	// Returns a hash-map.
	Map kiwi.Action = "MAP"
View Source
const Type kiwi.ValueType = "hash"

Type of set value.


View Source
var (
	ErrInvalidParamLen  = fmt.Errorf("not enough parameters")
	ErrInvalidParamType = fmt.Errorf("invalid paramater type")

Various errors for hash value type.


This section is empty.


type Value

type Value map[string]string

Value can store a string-string hash map.

It implements the kiwi.Value interface.

func (*Value) DoMap

func (v *Value) DoMap() map[kiwi.Action]kiwi.DoFunc

DoMap returns the map of v's actions with it's do functions.

func (*Value) FromJSON

func (v *Value) FromJSON(rawmessage json.RawMessage) error

FromJSON populates the s with the data from RawMessage

func (*Value) ToJSON

func (v *Value) ToJSON() (json.RawMessage, error)

ToJSON returns the raw byte array of s's data

func (*Value) Type

func (v *Value) Type() kiwi.ValueType

Type returns v's type, i.e., "set".

Jump to

Keyboard shortcuts

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