collection

package
v0.0.0-...-7690095 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ComfortLen = 10

Variables

This section is empty.

Functions

func Clone

func Clone(c interface{}, cloned ...interface{}) (res interface{})

func Filter

func Filter(slice interface{}, f func(interface{}) bool, dest ...interface{}) (res interface{})

func Foreach

func Foreach(slice interface{}, f func(interface{}, interface{}) bool)

func IsMatch

func IsMatch(slice interface{}, f func(interface{}) bool) bool

func Less

func Less(x interface{}, y interface{}) (lt bool)

func Map

func Map(slice interface{}, f func(interface{}) interface{}, dest ...interface{}) (res interface{})

func Match

func Match(slice interface{}, f func(interface{}) bool) (interface{}, interface{})

func Reduce

func Reduce(slice interface{}, f func(interface{}, interface{}) interface{}, init interface{}, dest ...interface{}) (res interface{})

Types

type Array

type Array interface {
	Append(value interface{}) Array
	Contains(value ...interface{}) bool
	Extend(values []interface{})
	ExtendArray(Array)
	First() interface{}
	Last() interface{}
	Index(value interface{}) int
	Indexes(value interface{}) []int
	LastIndex(value interface{}) int
	Set(index int, value interface{}) Array
	Insert(index int, value interface{}) Array
	MapValue(index int, value interface{}) interface{}
	Len() int
	Pop() interface{}
	Remove(value interface{})
	RemoveAt(index int) interface{}
	Reverse()
	Iterator() NumIterator
	String() string
	ToSlice() []interface{}
	Clear()
}

type Dict

type Dict struct {
	util.ValueGetter
	// contains filtered or unexported fields
}

func NewDict

func NewDict(def interface{}, m ...map[interface{}]interface{}) (d *Dict)

func (*Dict) Clear

func (d *Dict) Clear()

func (*Dict) Clone

func (d *Dict) Clone() *Dict

func (*Dict) Contains

func (d *Dict) Contains(values ...interface{}) bool

func (*Dict) Foreach

func (d *Dict) Foreach(f func(interface{}, interface{}) bool)

func (*Dict) HasKey

func (d *Dict) HasKey(key interface{}) (exists bool)

func (*Dict) IsMatch

func (d *Dict) IsMatch(f func(interface{}) bool) bool

func (*Dict) Iterator

func (d *Dict) Iterator() (di Iterator)

func (*Dict) KeyOf

func (d *Dict) KeyOf(value interface{}) interface{}

func (*Dict) Keys

func (d *Dict) Keys() (keys []interface{})

func (*Dict) KeysOf

func (d *Dict) KeysOf(value interface{}) (keys []interface{})

func (*Dict) KeysValues

func (d *Dict) KeysValues() (keys []interface{}, values []interface{})

func (*Dict) Len

func (d *Dict) Len() int

func (*Dict) MapValue

func (d *Dict) MapValue(key interface{}, value interface{}) (val interface{})

func (*Dict) Match

func (d *Dict) Match(f func(interface{}) bool) (interface{}, interface{})

func (*Dict) Pairs

func (d *Dict) Pairs() (pairs [][2]interface{})

func (*Dict) Pop

func (d *Dict) Pop() (key interface{}, value interface{})

func (*Dict) Remove

func (d *Dict) Remove(value interface{}) (keys []interface{})

func (*Dict) RemoveAt

func (d *Dict) RemoveAt(key interface{}) (value interface{})

func (*Dict) Set

func (d *Dict) Set(key interface{}, value interface{}) Dictionary

func (*Dict) SetDefault

func (d *Dict) SetDefault(key interface{}, value interface{}) Dictionary

func (*Dict) String

func (d *Dict) String() string

func (*Dict) ToMap

func (d *Dict) ToMap() map[interface{}]interface{}

func (*Dict) Transaction

func (d *Dict) Transaction(f func(ExtendedDictionary) bool)

func (*Dict) Update

func (d *Dict) Update(m map[interface{}]interface{})

func (*Dict) UpdateDict

func (d *Dict) UpdateDict(dt *Dict)

func (*Dict) UpdateDictionary

func (d *Dict) UpdateDictionary(dt Dictionary)

func (*Dict) UpdateOrderedDict

func (d *Dict) UpdateOrderedDict(od *OrderedDict)

func (*Dict) Values

func (d *Dict) Values() (values []interface{})

type DictIterator

type DictIterator struct {
	// contains filtered or unexported fields
}

this is not thread/concurrent safe

func (*DictIterator) Get

func (di *DictIterator) Get() (interface{}, interface{})

func (*DictIterator) Next

func (di *DictIterator) Next(val ...interface{}) bool

func (*DictIterator) Reset

func (di *DictIterator) Reset()

type Dictionary

type Dictionary interface {
	Contains(values ...interface{}) bool
	HasKey(key interface{}) bool
	KeyOf(value interface{}) interface{}
	Keys() []interface{}
	Values() []interface{}
	KeysValues() (keys []interface{}, values []interface{})
	Pairs() [][2]interface{}
	Pop() (key interface{}, value interface{})
	Len() int
	MapValue(key interface{}, value interface{}) interface{}
	Remove(value interface{}) []interface{}
	RemoveAt(key interface{}) interface{}
	Set(key interface{}, value interface{}) Dictionary
	SetDefault(key interface{}, value interface{}) Dictionary
	ToMap() map[interface{}]interface{}
	Update(map[interface{}]interface{})
	UpdateDictionary(Dictionary)
	Iterator() Iterator
	String() string
	Clear()
}

type ExtendedArray

type ExtendedArray interface {
	Array
	Less(x int, y int) bool
	Swap(x int, y int)
	Sort(less func(x interface{}, y interface{}) bool)
	Filter(func(interface{}) bool) ExtendedArray
	Foreach(func(int, interface{}) bool)
	IsMatch(func(interface{}) bool) bool
	Match(func(interface{}) bool) (index int, value interface{})
	Map(func(interface{}) interface{}) ExtendedArray
	Reduce(f func(interface{}, interface{}) interface{}, init interface{}) interface{}
	Transaction(func(ExtendedArray) bool)
}

type ExtendedDictionary

type ExtendedDictionary interface {
	Dictionary
	Foreach(f func(interface{}, interface{}) bool)
	IsMatch(func(interface{}) bool) bool
	Match(f func(interface{}) bool) (key interface{}, value interface{})
	Transaction(f func(ExtendedDictionary) bool)
}

type Iterator

type Iterator interface {
	Get() (interface{}, interface{})
	Next(...interface{}) bool
	Reset()
}

usage

for iter := li.Iterator(); iter.Next(&i, &value); {
    ...
    i, val := iter.GetI() // alternatively use this instead of .Next(&i, &value)
}

type List

type List struct {
	util.ValueGetter
	// contains filtered or unexported fields
}

func NewList

func NewList(data ...interface{}) (li *List)

func (*List) Append

func (l *List) Append(value interface{}) Array

func (*List) Clear

func (l *List) Clear()

func (*List) Clone

func (l *List) Clone() *List

func (*List) Contains

func (l *List) Contains(value ...interface{}) bool

func (*List) Extend

func (l *List) Extend(values []interface{})

func (*List) ExtendArray

func (l *List) ExtendArray(arr Array)

func (*List) ExtendList

func (l *List) ExtendList(list *List)

func (*List) ExtendSet

func (l *List) ExtendSet(set *Set)

func (*List) Filter

func (l *List) Filter(f func(interface{}) bool) ExtendedArray

func (*List) FilterList

func (l *List) FilterList(f func(interface{}) bool) (newlist *List)

func (*List) First

func (l *List) First() interface{}

func (*List) Foreach

func (l *List) Foreach(f func(int, interface{}) bool)

func (*List) Index

func (l *List) Index(value interface{}) int

func (*List) Indexes

func (l *List) Indexes(value interface{}) (indexes []int)

func (*List) Insert

func (l *List) Insert(index int, value interface{}) Array

func (*List) IsMatch

func (l *List) IsMatch(f func(interface{}) bool) bool

func (*List) Iterator

func (l *List) Iterator() NumIterator

func (*List) Last

func (l *List) Last() interface{}

func (*List) LastIndex

func (l *List) LastIndex(value interface{}) int

func (*List) Len

func (l *List) Len() int

func (*List) Less

func (l *List) Less(x int, y int) bool

func (*List) Map

func (l *List) Map(f func(interface{}) interface{}) ExtendedArray

func (*List) MapList

func (l *List) MapList(f func(interface{}) interface{}) (newlist *List)

func (*List) MapValue

func (l *List) MapValue(index int, value interface{}) (val interface{})

func (*List) Match

func (l *List) Match(f func(interface{}) bool) (int, interface{})

func (*List) Pop

func (l *List) Pop() interface{}

func (*List) Reduce

func (l *List) Reduce(f func(interface{}, interface{}) interface{}, init interface{}) (value interface{})

func (*List) Remove

func (l *List) Remove(value interface{})

func (*List) RemoveAt

func (l *List) RemoveAt(index int) interface{}

func (*List) Reverse

func (l *List) Reverse()

func (*List) Set

func (l *List) Set(index int, value interface{}) Array

func (*List) Sort

func (l *List) Sort(less func(x interface{}, y interface{}) bool)

func (*List) String

func (l *List) String() string

func (*List) Swap

func (l *List) Swap(x int, y int)

func (*List) ToSet

func (l *List) ToSet() (set *Set)

func (*List) ToSlice

func (l *List) ToSlice() []interface{}

func (*List) Transaction

func (l *List) Transaction(f func(ExtendedArray) bool)

type ListIterator

type ListIterator struct {
	// contains filtered or unexported fields
}

usage

for iter := li.Iterator(); iter.Next(&i, &value); {
    ...
    i, val := iter.GetI() // alternatively use this instead of .Next(&i, &value)
}

func (*ListIterator) Get

func (li *ListIterator) Get() (interface{}, interface{})

func (*ListIterator) GetI

func (li *ListIterator) GetI() (int, interface{})

func (*ListIterator) Next

func (li *ListIterator) Next(val ...interface{}) (ok bool)

func (*ListIterator) Reset

func (li *ListIterator) Reset()

type NumIterator

type NumIterator interface {
	Iterator
	GetI() (int, interface{})
}

type OrderedDict

type OrderedDict struct {
	util.ValueGetter
	// contains filtered or unexported fields
}

func NewOrderedDict

func NewOrderedDict(def interface{}, m ...map[interface{}]interface{}) (d *OrderedDict)

func (*OrderedDict) Clear

func (od *OrderedDict) Clear()

func (*OrderedDict) Clone

func (od *OrderedDict) Clone() *OrderedDict

func (*OrderedDict) Contains

func (od *OrderedDict) Contains(values ...interface{}) bool

func (*OrderedDict) Foreach

func (od *OrderedDict) Foreach(f func(interface{}, interface{}) bool)

func (*OrderedDict) HasKey

func (od *OrderedDict) HasKey(key interface{}) (exists bool)

func (*OrderedDict) IsMatch

func (od *OrderedDict) IsMatch(f func(interface{}) bool) bool

func (*OrderedDict) Iterator

func (od *OrderedDict) Iterator() (di Iterator)

func (*OrderedDict) KeyOf

func (od *OrderedDict) KeyOf(value interface{}) interface{}

func (*OrderedDict) Keys

func (od *OrderedDict) Keys() []interface{}

func (*OrderedDict) KeysOf

func (od *OrderedDict) KeysOf(value interface{}) (keys []interface{})

func (*OrderedDict) KeysValues

func (od *OrderedDict) KeysValues() ([]interface{}, []interface{})

func (*OrderedDict) Len

func (od *OrderedDict) Len() int

func (*OrderedDict) MapValue

func (od *OrderedDict) MapValue(key interface{}, value interface{}) (val interface{})

func (*OrderedDict) Match

func (od *OrderedDict) Match(f func(interface{}) bool) (interface{}, interface{})

func (*OrderedDict) Pairs

func (od *OrderedDict) Pairs() (pairs [][2]interface{})

func (*OrderedDict) Pop

func (od *OrderedDict) Pop() (key interface{}, value interface{})

func (*OrderedDict) Remove

func (od *OrderedDict) Remove(value interface{}) (keys []interface{})

func (*OrderedDict) RemoveAt

func (od *OrderedDict) RemoveAt(key interface{}) interface{}

func (*OrderedDict) Reverse

func (od *OrderedDict) Reverse()

func (*OrderedDict) Set

func (od *OrderedDict) Set(key interface{}, value interface{}) Dictionary

func (*OrderedDict) SetDefault

func (od *OrderedDict) SetDefault(key interface{}, value interface{}) Dictionary

func (*OrderedDict) Sort

func (od *OrderedDict) Sort(less func(x interface{}, y interface{}) bool)

func (*OrderedDict) SortByKey

func (od *OrderedDict) SortByKey(less func(x interface{}, y interface{}) bool)

func (*OrderedDict) String

func (od *OrderedDict) String() string

func (*OrderedDict) ToMap

func (od *OrderedDict) ToMap() map[interface{}]interface{}

func (*OrderedDict) Transaction

func (od *OrderedDict) Transaction(f func(ExtendedDictionary) bool)

func (*OrderedDict) Update

func (od *OrderedDict) Update(m map[interface{}]interface{})

func (*OrderedDict) UpdateDict

func (od *OrderedDict) UpdateDict(d *Dict)

func (*OrderedDict) UpdateDictionary

func (od *OrderedDict) UpdateDictionary(d Dictionary)

func (*OrderedDict) UpdateOrderedDict

func (od *OrderedDict) UpdateOrderedDict(d *OrderedDict)

func (*OrderedDict) Values

func (od *OrderedDict) Values() []interface{}

type OrderedDictIterator

type OrderedDictIterator struct {
	// contains filtered or unexported fields
}

func (*OrderedDictIterator) Get

func (di *OrderedDictIterator) Get() (interface{}, interface{})

func (*OrderedDictIterator) Next

func (di *OrderedDictIterator) Next(val ...interface{}) (ok bool)

func (*OrderedDictIterator) Reset

func (di *OrderedDictIterator) Reset()

type PopIterator

type PopIterator interface {
	NumIterator
	PopNext(...interface{}) bool
}

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(data ...interface{}) (q *Queue)

func (*Queue) Clear

func (q *Queue) Clear()

func (*Queue) Clone

func (q *Queue) Clone() (qu *Queue)

func (*Queue) First

func (q *Queue) First() (val interface{})

func (*Queue) HasQueue

func (q *Queue) HasQueue() bool

func (*Queue) Iterator

func (q *Queue) Iterator() PopIterator

func (*Queue) Last

func (q *Queue) Last() (val interface{})

func (*Queue) Len

func (q *Queue) Len() int

func (*Queue) Pull

func (q *Queue) Pull() (val interface{})

func (*Queue) PullDefault

func (q *Queue) PullDefault(def interface{}) interface{}

func (*Queue) PullOk

func (q *Queue) PullOk() (val interface{}, ok bool)

func (*Queue) Push

func (q *Queue) Push(val ...interface{})

func (*Queue) String

func (q *Queue) String() string

func (*Queue) ToList

func (q *Queue) ToList() *List

func (*Queue) ToSlice

func (q *Queue) ToSlice() []interface{}

type QueueIterator

type QueueIterator struct {
	// contains filtered or unexported fields
}

func (*QueueIterator) Get

func (qi *QueueIterator) Get() (interface{}, interface{})

func (*QueueIterator) GetI

func (qi *QueueIterator) GetI() (int, interface{})

func (*QueueIterator) Next

func (qi *QueueIterator) Next(val ...interface{}) (ok bool)

func (*QueueIterator) PopNext

func (qi *QueueIterator) PopNext(val ...interface{}) (ok bool)

func (*QueueIterator) Reset

func (qi *QueueIterator) Reset()

type Set

type Set struct {
	util.ValueGetter
	// contains filtered or unexported fields
}

func NewSet

func NewSet(data ...interface{}) (li *Set)

func (*Set) Append

func (s *Set) Append(value interface{}) Array

func (*Set) Clear

func (s *Set) Clear()

func (*Set) Clone

func (s *Set) Clone() *Set

func (*Set) Contains

func (s *Set) Contains(value ...interface{}) bool

func (*Set) Extend

func (s *Set) Extend(values []interface{})

func (*Set) ExtendArray

func (s *Set) ExtendArray(arr Array)

func (*Set) ExtendList

func (s *Set) ExtendList(list *List)

func (*Set) ExtendSet

func (s *Set) ExtendSet(set *Set)

func (*Set) Filter

func (s *Set) Filter(f func(interface{}) bool) ExtendedArray

func (*Set) FilterSet

func (s *Set) FilterSet(f func(interface{}) bool) (newset *Set)

func (*Set) First

func (s *Set) First() interface{}

func (*Set) Foreach

func (s *Set) Foreach(f func(int, interface{}) bool)

func (*Set) Get

func (s *Set) Get(index int) interface{}

func (*Set) Index

func (s *Set) Index(value interface{}) int

func (*Set) Indexes

func (s *Set) Indexes(value interface{}) []int

func (*Set) Insert

func (s *Set) Insert(index int, value interface{}) Array

func (*Set) IsMatch

func (s *Set) IsMatch(f func(interface{}) bool) bool

func (*Set) Iterator

func (s *Set) Iterator() NumIterator

func (*Set) Last

func (s *Set) Last() interface{}

func (*Set) LastIndex

func (s *Set) LastIndex(value interface{}) int

func (*Set) Len

func (s *Set) Len() int

func (*Set) Less

func (s *Set) Less(x int, y int) bool

func (*Set) Map

func (s *Set) Map(f func(interface{}) interface{}) ExtendedArray

func (*Set) MapSet

func (s *Set) MapSet(f func(interface{}) interface{}) (newset *Set)

func (*Set) MapValue

func (s *Set) MapValue(index int, value interface{}) (val interface{})

func (*Set) Match

func (s *Set) Match(f func(interface{}) bool) (int, interface{})

func (*Set) Pop

func (s *Set) Pop() (val interface{})

func (*Set) Reduce

func (s *Set) Reduce(f func(interface{}, interface{}) interface{}, init interface{}) (value interface{})

func (*Set) Remove

func (s *Set) Remove(value interface{})

func (*Set) RemoveAt

func (s *Set) RemoveAt(index int) (val interface{})

func (*Set) Reverse

func (s *Set) Reverse()

func (*Set) Set

func (s *Set) Set(index int, value interface{}) Array

func (*Set) Sort

func (s *Set) Sort(f func(x interface{}, y interface{}) bool)

func (*Set) String

func (s *Set) String() string

func (*Set) Swap

func (s *Set) Swap(x int, y int)

func (*Set) ToList

func (s *Set) ToList() *List

func (*Set) ToSlice

func (s *Set) ToSlice() []interface{}

func (*Set) Transaction

func (s *Set) Transaction(f func(ExtendedArray) bool)

type SortDictValue

type SortDictValue struct {
	// contains filtered or unexported fields
}

func (*SortDictValue) Len

func (sd *SortDictValue) Len() int

func (*SortDictValue) Less

func (sd *SortDictValue) Less(x int, y int) bool

func (*SortDictValue) Swap

func (sd *SortDictValue) Swap(x int, y int)

type SortList

type SortList struct {
	// contains filtered or unexported fields
}

func (*SortList) Len

func (sl *SortList) Len() int

func (*SortList) Less

func (sl *SortList) Less(x int, y int) bool

func (*SortList) Swap

func (sl *SortList) Swap(x int, y int)

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack(data ...interface{}) (s *Stack)

func (*Stack) Clear

func (s *Stack) Clear()

func (*Stack) Clone

func (s *Stack) Clone() (st *Stack)

func (*Stack) Last

func (s *Stack) Last() (value interface{})

func (*Stack) Len

func (s *Stack) Len() int

func (*Stack) Pop

func (s *Stack) Pop() (value interface{})

func (*Stack) PopOk

func (s *Stack) PopOk() (value interface{}, ok bool)

func (*Stack) Push

func (s *Stack) Push(value interface{})

func (*Stack) String

func (s *Stack) String() string

func (*Stack) ToList

func (s *Stack) ToList() *List

func (*Stack) ToSlice

func (s *Stack) ToSlice() (slice []interface{})

Jump to

Keyboard shortcuts

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