An ordered map for Golang.
This library provides the following functionalities:
- A map which is like a Go standard map, and provide same methods with Go sync.Map except
CompareAndDelete
andCompareAndSwap
. (Concurrent use is not supported.) Front
andBack
methods that iterates map entries in the order of key insertions.Ldelete
andLoadAndLdelete
methods for logical deletions, becauseStore
andDelete
are slower than Go standard map.LoadOrStoreFunc
method which stores a result of a give function when an entry for the specified key is not present.MarshalJSON
andUnmarshalJSON
methods for JSON serialization and deserialization. These methods are implementations ofjson.Marshaler
andjson.Unmarshaler
interfaces.
import "github.com/sttk/orderedmap"
The usage of this package is described on the overview in the go package document.
See https://pkg.go.dev/github.com/sttk/orderedmap#pkg-overview.
This framework supports Go 1.18 or later.
% gvm-fav
Now using version go1.18.10
go version go1.18.10 darwin/amd64
ok github.com/sttk/orderedmap 0.244s coverage: 99.3% of statements
Now using version go1.19.13
go version go1.19.13 darwin/amd64
ok github.com/sttk/orderedmap 0.255s coverage: 99.3% of statements
Now using version go1.20.14
go version go1.20.14 darwin/amd64
ok github.com/sttk/orderedmap 0.212s coverage: 99.3% of statements
Now using version go1.21.7
go version go1.21.7 darwin/amd64
ok github.com/sttk/orderedmap 0.205s coverage: 99.3% of statements
Now using version go1.22
go version go1.22.0 darwin/amd64
ok github.com/sttk/orderedmap 0.206s coverage: 99.3% of statements
Back to go1.22
Now using version go1.22
Copyright (C) 2023-2024 Takayuki Sato
This program is free software under MIT License.
See the file LICENSE in this distribution for more details.