Files
2026-07-27 16:14:41 +02:00

41 lines
708 B
Go

package main
import "github.com/shopspring/decimal"
// Dimension represents the physical dimension of a unit.
type Dimension int
const (
DimNone Dimension = iota
DimCurrency
DimLength
DimMass
DimTime
DimDigital
DimArea
DimTemp
DimAngle
DimIP
DimCIDR
DimString
)
// Result holds the evaluated numeric value and its dimension.
type Result struct {
Value decimal.Decimal
Dim Dimension
}
// UnitInfo stores the conversion factor (to the pivot unit) and its dimension.
type UnitInfo struct {
Factor decimal.Decimal
Dimension Dimension
Label string
}
// UserFunc represents a user-defined function.
type UserFunc struct {
Args []string `json:"args"`
Expr string `json:"expr"`
}