Skip to content

Latest commit

 

History

History
407 lines (253 loc) · 7.91 KB

File metadata and controls

407 lines (253 loc) · 7.91 KB

orderedmap

import "github.com/fufuok/utils/orderedmap"

Index

type ByPair

type ByPair struct {
    Pairs    []*Pair
    LessFunc func(a *Pair, j *Pair) bool
}

func (ByPair) Len

func (a ByPair) Len() int

func (ByPair) Less

func (a ByPair) Less(i, j int) bool

func (ByPair) Swap

func (a ByPair) Swap(i, j int)

type ByPairOf

type ByPairOf[K comparable, V any] struct {
    Pairs    []*PairOf[K, V]
    LessFunc func(a *PairOf[K, V], j *PairOf[K, V]) bool
}

func (ByPairOf[K, V]) Len

func (a ByPairOf[K, V]) Len() int

func (ByPairOf[K, V]) Less

func (a ByPairOf[K, V]) Less(i, j int) bool

func (ByPairOf[K, V]) Swap

func (a ByPairOf[K, V]) Swap(i, j int)

type OrderedMap

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

func New

func New() *OrderedMap

func (*OrderedMap) Delete

func (o *OrderedMap) Delete(key string)

func (*OrderedMap) Get

func (o *OrderedMap) Get(key string) (interface{}, bool)

func (*OrderedMap) Keys

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

func (OrderedMap) MarshalJSON

func (o OrderedMap) MarshalJSON() ([]byte, error)

func (*OrderedMap) Set

func (o *OrderedMap) Set(key string, value interface{})

func (*OrderedMap) SetEscapeHTML

func (o *OrderedMap) SetEscapeHTML(on bool)

func (*OrderedMap) Sort

func (o *OrderedMap) Sort(lessFunc func(a *Pair, b *Pair) bool)

Sort the map using your sort func

func (*OrderedMap) SortKeys

func (o *OrderedMap) SortKeys(sortFunc ...func(keys []string))

SortKeys Sort the map keys using your sort func

func (*OrderedMap) UnmarshalJSON

func (o *OrderedMap) UnmarshalJSON(b []byte) error

func (*OrderedMap) Values

func (o *OrderedMap) Values() map[string]interface{}

type OrderedMapOf

type OrderedMapOf[K comparable, V any] struct {
    // contains filtered or unexported fields
}

func NewOf

func NewOf[K comparable, V any]() *OrderedMapOf[K, V]

func (*OrderedMapOf[K, V]) Clone

func (o *OrderedMapOf[K, V]) Clone() *OrderedMapOf[K, V]

func (*OrderedMapOf[K, V]) Delete

func (o *OrderedMapOf[K, V]) Delete(key K)

func (*OrderedMapOf[K, V]) Get

func (o *OrderedMapOf[K, V]) Get(key K) (V, bool)

func (*OrderedMapOf[K, V]) Keys

func (o *OrderedMapOf[K, V]) Keys() []K

func (*OrderedMapOf[K, V]) MustGet

func (o *OrderedMapOf[K, V]) MustGet(key K) V

func (*OrderedMapOf[K, V]) Set

func (o *OrderedMapOf[K, V]) Set(key K, value V)

func (*OrderedMapOf[K, V]) Sort

func (o *OrderedMapOf[K, V]) Sort(lessFunc func(a *PairOf[K, V], b *PairOf[K, V]) bool)

Sort the map using your sort func

func (*OrderedMapOf[K, V]) SortKeys

func (o *OrderedMapOf[K, V]) SortKeys(sortFunc func(keys []K))

SortKeys Sort the map keys using your sort func

func (*OrderedMapOf[K, V]) ToMap

func (o *OrderedMapOf[K, V]) ToMap() map[K]V

func (*OrderedMapOf[K, V]) Values

func (o *OrderedMapOf[K, V]) Values() map[K]V

type Pair

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

func (*Pair) Key

func (kv *Pair) Key() string

func (*Pair) Value

func (kv *Pair) Value() interface{}

type PairOf

type PairOf[K comparable, V any] struct {
    // contains filtered or unexported fields
}

func (*PairOf[K, V]) Key

func (kv *PairOf[K, V]) Key() K

func (*PairOf[K, V]) Value

func (kv *PairOf[K, V]) Value() V

Generated by gomarkdoc