Releases: pinealctx/x
Releases · pinealctx/x
v0.3.0
What's New
ds.SortedMap[K,V]
Ordered map combining O(1) random access by key with O(log n) sorted iteration. Backed by a hash map and B-tree. The sort key and the map lookup key can be different fields of V.
m := ds.NewSortedMap[int, Item](
func(v Item) int { return v.ID },
func(a, b Item) bool { return a.Score < b.Score },
)
m.Set(Item{ID: 1, Score: 3.0})
for v := range m.Ascend() {
fmt.Println(v.ID, v.Score)
}
Breaking Changes
- ds.Set.Contains(val) renamed to ds.Set.Has(val) for consistency with other container types
Improvements
- Unified panic message format to "pkg: FuncName: condition" across ds, syncx, retryx
- Added SortedMap documentation explaining why Clone()/Keys()/Values() are not provided
- Fixed README dependency claim ("Zero" → "Minimal") and added SortedMap section
Full Changelog
- 939f170 Add ds.SortedMap[K,V] backed by hash map + B-tree
- 86530e4 Fix API consistency and panic message format from full auditv0.2.0 — 2026-04-10
v0.2.0 — 2026-04-10
Adds three new packages, syncx.Race, and several fixes.
Requires Go 1.26+. Zero external dependencies.
New packages
panicx — Panic recovery with structured stack capture.
NewPanicError(r)/NewPanicErrorSkip(r, skip)— convert recovered value to*PanicErrorErrPanicsentinel — checkable viaerrors.Is(err, panicx.ErrPanic)Stack()— returns captured stack frames as[]string
handlerx — Generic, framework-agnostic middleware chain for RPC handlers.
Handler[Req, Resp]/Interceptor[Req, Resp]— core function typesChain— composes interceptors around a handler, outermost-firstWithTimeout/WithRecovery— built-in interceptors
pipeline — Declarative step-execution graph.
Then— sequential stepParallel— concurrent, all must succeedRace— concurrent, first success wins
New APIs
syncx.Race[T]— returns the first successful result from concurrent functions; if all fail, returns the last error.
Fixes
syncx.Group/syncx.SingleFlight— panic recovery now produces*panicx.PanicError(checkable viaerrors.Is(err, panicx.ErrPanic)) instead of opaquefmt.Errorf.retryx.NewExponential— large attempt values no longer overflowtime.Durationto negative; capped atmath.MaxInt64.ds.Heap—Popclears the slot to help GC with pointer-typed elements.
Other changes
go.modbumped to1.26.2.README.mdupdated with all 8 packages, accurate API examples, and complete method references.
Quality
- 100% test coverage across all 8 packages
- Race-detector clean (
go test -race ./...) golangci-lintandgovulncheckpass with zero issues
First release of `github.com/pinealctx/x`.
v0.1.0 — 2026-04-07
First release of github.com/pinealctx/x.
Requires Go 1.26+. Zero external dependencies.
New packages
errorx — Typed error codes and domain-isolated sentinels.
Error[Code]— coded error with optional cause chainSentinel[D]— phantom-type sentinel, prevents cross-domainerrors.IsIsCode/ContainsCode— chain-aware code queries
syncx — Generic concurrent primitives.
KeyedMutex[K]/KeyedLocker[K]— per-key mutex/rwmutex with ref-counted cleanupBlockingQueue[T]— context-aware blocking queue with close semanticsRingQueue[T]— fixed-capacity queue, evicts oldest on fullReadThrough[K,V]— cache-aside with per-key stampede protectionPool[T]— type-safesync.Poolwrapper with optional resetDispatcher[K,V]— key-hash routed slot dispatcher, preserves per-key orderingSingleFlight[K,V]— concurrent call deduplication per keyGroup[T]— concurrent result collector, submission-order results, panic recovery
ds — Generic data structures.
OrderedMap[K,V]— insertion-ordered map, O(1) access, zero-allocation iterationSet[T]— set algebra and relation checksBiMap[K,V]— bidirectional O(1) lookupStack[T]— LIFO stackHeap[T]— binary heap with custom comparator (NewMinHeap/NewMaxHeap)
retryx — Generic retry with composable backoff.
Do[T]— retries a function withAttempts,Backoff,RetryIf,OnRetryNewExponential/NewFixed— backoff basesWithJitter/WithMaxWait— backoff decorators
ctxv — Type-safe context values.
Key[T]— generic context key bound to type TWithValue/Value/MustValue— compile-time type-safe context access