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.315s coverage: 99.3% of statements
Now using version go1.19.13
go version go1.19.13 darwin/amd64
ok github.com/sttk/orderedmap 0.305s coverage: 99.3% of statements
Now using version go1.20.14
go version go1.20.14 darwin/amd64
ok github.com/sttk/orderedmap 0.315s coverage: 99.3% of statements
Now using version go1.21.13
go version go1.21.13 darwin/amd64
ok github.com/sttk/orderedmap 0.315s coverage: 99.3% of statements
Now using version go1.22.12
go version go1.22.12 darwin/amd64
ok github.com/sttk/orderedmap 0.312s coverage: 99.3% of statements
Now using version go1.23.10
go version go1.23.10 darwin/amd64
ok github.com/sttk/orderedmap 0.316s coverage: 99.3% of statements
Now using version go1.24.6
go version go1.24.6 darwin/amd64
ok github.com/sttk/orderedmap 0.322s coverage: 99.3% of statements
Now using version go1.25.0
go version go1.25.0 darwin/amd64
ok github.com/sttk/orderedmap 0.325s coverage: 99.3% of statements
Back to go1.25.0
Now using version go1.25.0
Copyright (C) 2023-2025 Takayuki Sato
This program is free software under MIT License.
See the file LICENSE in this distribution for more details.