orderedmap

package module
v0.0.0-...-c160cc2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2015 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderedMap

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

OrderedMap handles url query string paramaters respecting order We replicate the interface of the default net/url.Values

func NewOrderedMap

func NewOrderedMap(keypairs [][]string) (*OrderedMap, error)

NewOrderedMap takes a set of params, validates them and return the params to use Seriously, use this rather than constructing OrderedMap directly. It'll keep your sanity

func (*OrderedMap) Add

func (m *OrderedMap) Add(key, value string)

Add add the key-value to the params list This will not delete any existing pairs matching the key param

func (*OrderedMap) Del

func (m *OrderedMap) Del(key string)

Del removes all values with the passed in key

func (*OrderedMap) Get

func (m *OrderedMap) Get(key string) string

Get gets the first value associated with key. If empty, returns an empty string

func (*OrderedMap) GetAll

func (m *OrderedMap) GetAll(key string) []string

Get a list of values based on the key

func (*OrderedMap) Keys

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

Keys returns all keys that exist in our OrderedMap

func (*OrderedMap) Len

func (m *OrderedMap) Len() int

Len get's the total number of entries within the map

func (*OrderedMap) Map

func (m *OrderedMap) Map() map[string][]string

Map converts the our ordered list to a map

func (*OrderedMap) Remove

func (m *OrderedMap) Remove(key, val string)

Remove removes the key value pair from the params list

func (*OrderedMap) Set

func (m *OrderedMap) Set(key, val string)

Set sets the key to val. All existing values are replaced

func (*OrderedMap) String

func (m *OrderedMap) String() string

String converts the query params into consumable query param strings

type OrderedMappable

type OrderedMappable interface {
	Add(key, value string)
	Del(key string)
	Get(key string) string
	Set(key, value string)
	Len() int
	String() string
	GetAll(key string) []string
}

OrderedMappable replicates the default net/url.Values interface

Jump to

Keyboard shortcuts

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