Documentation

Overview

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

Index

Constants

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"
)

const Type kiwi.ValueType = "hash"

Type of set value.


Variables

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

Various errors for hash value type.


Functions

This section is empty.

Types

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".

Source Files