Skip to content

v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 11 Nov 17:41

0.5.0 (2026-11-11)

⚠ BREAKING CHANGES

  • Go 1.26 is required (was 1.23).
  • the package github.com/aeimer/go-multikeymap/container is gone. Define the interface you need in your own package instead.
  • the exported embedded fields MultiKeyMap and BiKeyMap of the concurrent types are gone. Use the methods of the concurrent type instead.
  • methods of all four map types are renamed to the names of the Go standard library, see the migration table below.
  • Values returns an iter.Seq instead of a slice. Use slices.Collect(m.Values()) if you need a slice.
  • Delete methods return nothing. A delete of a missing key is a no-op.
  • multikeymap: AddSecondaryKeys (was PutSecondaryKeys) returns false and stores nothing if the primary key is absent. A secondary key that belongs to another primary key moves to this one.
  • multikeymap: KeyGroups (was GetAllKeyGroups) is removed. Use the iterators Groups and GroupKeys instead.
  • bikeymap: Set (was Put) returns no error any more, it overwrites like a Go map. If keyA is paired with another keyB, that keyB is removed. If keyB is paired with another keyA, the entry of that keyA is removed. Len shrinks by at most one.

Migration

v0.4.1 v0.5.0
multikeymap Put(k, v) Set(k, v)
multikeymap PutSecondaryKeys(k, g, keys...) AddSecondaryKeys(k, g, keys...) bool
multikeymap HasPrimaryKey(k) Has(k)
multikeymap Remove(k) Delete(k)
multikeymap GetAllKeyGroups() Groups(), GroupKeys(g) (iterators)
bikeymap Put(a, b, v) error Set(a, b, v) (overwrites, no error)
bikeymap RemoveByKeyA(a) error DeleteByKeyA(a)
bikeymap RemoveByKeyB(b) error DeleteByKeyB(b)
both: Size() Len()
both: Empty() Len() == 0
both: Values() []V Values() iter.Seq[V]
both: Get…, HasSecondaryKey, Clear, String unchanged

New in both packages: All, key iterators, Clone, DeleteFunc, LoadAndDelete…, key lookups between keys; multikeymap also LoadOrStore, Update, DeleteSecondaryKey, DeleteGroup; bikeymap also Pairs.
The zero value of every type is ready to use.

Features

  • add All and key iterators (acbcabf)
  • add atomic load-or-store, load-and-delete and update (63c3950)
  • add Clone and DeleteFunc (0a670f6)
  • add key lookups between primary and secondary keys (1d7ab4d)
  • bikeymap: add Pairs iterator (b791b93)
  • bikeymap: let Set overwrite conflicting pairs (37c5ee5)
  • make the zero value of all map types ready to use (aaf6729)
  • multikeymap: add LoadAndDeleteBySecondaryKey (4193a06)
  • multikeymap: delete secondary keys and groups (9f2c756)
  • multikeymap: replace KeyGroups with Groups and GroupKeys iterators (bd37ec6)

Bug Fixes

  • bikeymap: lock Len in ConcurrentBiKeyMap (a688451)
  • deps: bump actions/checkout from 4 to 5 (#13) (cd876bb)
  • deps: bump actions/checkout from 5 to 6 (#15) (e83de7a)
  • deps: bump actions/checkout from 6 to 7 (#18) (e61dc3e)
  • deps: bump actions/setup-go from 5 to 6 (#14) (ae265f8)
  • deps: bump actions/setup-go from 6 to 7 (#19) (5691fed)
  • deps: bump github.com/stretchr/testify from 1.10.0 to 1.11.0 (#10) (f980415)
  • deps: bump github.com/stretchr/testify from 1.11.0 to 1.11.1 (#12) (bff8d91)
  • deps: bump github.com/stretchr/testify from 1.11.1 to 1.12.0 (#20) (6fef2b7)
  • deps: bump github.com/stretchr/testify from 1.12.0 to 1.12.1 (#21) (c69bc23)
  • deps: bump golangci/golangci-lint-action from 7 to 8 (#9) (e955944)
  • deps: bump golangci/golangci-lint-action from 8 to 9 (#16) (40c0eea)
  • deps: bump googleapis/release-please-action from 4 to 5 (#17) (e93c5f9)
  • format String of concurrent maps outside the lock (db2a446)
  • hide embedded map in concurrent types (86633d5)
  • keep iteration consistent when Clear runs during a range (a2cf40a)
  • multikeymap: report missing primary key in AddSecondaryKeys (3b7cc8a)
  • multikeymap: track all secondary keys per group in reverse index (2635368)

Performance Improvements

  • bikeymap: store keyB next to the value (8a57a68)

Code Refactoring

  • bikeymap: align method names with the standard library (8cfb0f4)
  • multikeymap: align method names with the standard library (9e27b26)
  • remove container package (c5550c2)