transform

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accumulate

type Accumulate[T Numeric] struct{}

Accumulate adds each value to a running total. Requires T to support the + operator (int, int64, float64, etc.).

func NewAccumulate

func NewAccumulate[T Numeric]() *Accumulate[T]

NewAccumulate creates a transform that accumulates values.

func (*Accumulate[T]) Apply

func (t *Accumulate[T]) Apply(incoming T, state State[T]) T

Apply adds the incoming value to the current state and returns the new total.

func (*Accumulate[T]) Name

func (t *Accumulate[T]) Name() string

Name returns the transform identifier.

type Numeric

type Numeric interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~float32 | ~float64
}

Numeric defines types that support arithmetic operations.

type State

type State[T any] interface {
	GetState() T
}

State provides read-only access to current state.

type Transformation

type Transformation[T any] interface {
	Apply(incoming T, state State[T]) T
	Name() string
}

Transformation modifies a value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL