Repository navigation
V0.1.0
Release v0.1.0
First stable release of simv - a Go library for simulating time-varying values in testing environments.
Features
Core Architecture:
- Clock-driven value generation with subscription model
- Generic type support for all value types
- Thread-safe concurrent access patterns
- Automatic goroutine lifecycle management
Clock Package:
PeriodicClock- fixed-interval tick generation- Clean start/stop lifecycle
Source Package:
ConstSource- constant value generationRandomIntSource- random integers in range [min, max]- Channel-based subscription distribution
Transform Package:
Accumulate- running totals for numeric types- Stateful transform pattern with read-only state access
Value Package:
SimpleValue- standard source + transforms pipelineResetOnRead- value wrapper that resets on each readUpdateHookinterface for observabilityTraceHookwith event capture and console formatting
Example:
- Complete working demonstration in
cmd/example/main.go - Shows clock → source → transform → value → trace pipeline
Requirements
- Go 1.25+
- Standard library only (no external dependencies)
Installation
go get github.com/neox5/simv@v0.1.0Usage
clk := clock.NewPeriodicClock(100 * time.Millisecond)
src := source.NewRandomIntSource(clk, 1, 10)
val := value.New(src, transform.NewAccumulate[int]())
resetVal := value.NewResetOnRead(val.Clone(), 0)
resetVal.SetUpdateHook(value.NewDefaultTraceHook[int]())
clk.Start()
defer clk.Stop()
current := resetVal.Value()Documentation
See README.md for complete documentation and usage examples.