Skip to content

V0.1.0

Choose a tag to compare

@neox5 neox5 released this 12 Jan 14:03
· 12 commits to main since this release

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 generation
  • RandomIntSource - 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 pipeline
  • ResetOnRead - value wrapper that resets on each read
  • UpdateHook interface for observability
  • TraceHook with 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.0

Usage

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.