initial commit [141.14.140.180,mike]
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user