package orderedmap
import "github.com/ClickHouse/clickhouse-go/v2/lib/column/orderedmap"
Index ¶
- type Map
- func Collect[K cmp.Ordered, V any](seq func(yield func(K, V) bool)) *Map[K, V]
- func CollectFunc[K comparable, V any](seq func(yield func(K, V) bool), compare func(K, K) int) *Map[K, V]
- func CollectN[K cmp.Ordered, V any](seq func(yield func(K, V) bool), n int) *Map[K, V]
- func CollectNFunc[K comparable, V any](seq func(yield func(K, V) bool), n int, compare func(K, K) int) *Map[K, V]
- func FromMap[M ~map[K]V, K cmp.Ordered, V any](m M) *Map[K, V]
- func FromMapFunc[M ~map[K]V, K comparable, V any](m M, compare func(K, K) int) *Map[K, V]
- func (om *Map[K, V]) All(yield func(k K, v V) bool)
- func (om *Map[K, V]) Iterator() column.MapIterator
- func (om *Map[K, V]) Keys(yield func(k K) bool)
- func (om *Map[K, V]) Put(key any, value any)
- func (om *Map[K, V]) ToMap() map[K]V
- func (om *Map[K, V]) Values(yield func(v V) bool)
Types ¶
type Map ¶
type Map[K comparable, V any] []entry[K, V]
Map is a simple implementation of column.IterableOrderedMap interface. It is intended to be used as a serdes wrapper for map[K]V and not as a general purpose container.
func Collect ¶
Collect creates a Map from an iter.Seq2[K,V] iterator.
func CollectFunc ¶
func CollectFunc[K comparable, V any](seq func(yield func(K, V) bool), compare func(K, K) int) *Map[K, V]
CollectFunc creates a Map from an iter.Seq2[K,V] iterator with a custom compare function.
func CollectN ¶
CollectN creates a Map, pre-sized for n entries, from an iter.Seq2[K,V] iterator.
func CollectNFunc ¶
func CollectNFunc[K comparable, V any](seq func(yield func(K, V) bool), n int, compare func(K, K) int) *Map[K, V]
CollectNFunc creates a Map, pre-sized for n entries, from an iter.Seq2[K,V] iterator with a custom compare function.
func FromMap ¶
func FromMapFunc ¶
func FromMapFunc[M ~map[K]V, K comparable, V any](m M, compare func(K, K) int) *Map[K, V]
func (*Map[K, V]) All ¶
All is an iter.Seq[K,V] iterator that yields all key-value pairs in order.
func (*Map[K, V]) Iterator ¶
func (om *Map[K, V]) Iterator() column.MapIterator
Iterator is part of column.IterableOrderedMap interface, it expects to be called by the driver itself.
func (*Map[K, V]) Keys ¶
Keys is an iter.Seq[K] iterator that yields all keys in order.
func (*Map[K, V]) Put ¶
Put is part of column.IterableOrderedMap interface, it expects to be called by the driver itself, provides no type safety and expects the keys to be given in order. It is recommended to use FromMap and Collect to initialize Map.
func (*Map[K, V]) ToMap ¶
func (om *Map[K, V]) ToMap() map[K]V
func (*Map[K, V]) Values ¶
Values is an iter.Seq[V] iterator that yields all values in key order.
Source Files ¶
- Version
- v2.30.2
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 hour ago –
Tools for package owners.