Documentation
¶
Overview ¶
Package quant provides type-safe physical quantities and unit conversions using generics.
Quantities are stored in dimension-specific base units, and conversions are checked at compile time through phantom type parameters. The package includes built-in dimensions for common physical quantities, convenience constructors, same-dimension arithmetic, derived units such as speed from length divided by time, formatting helpers, and JSON, text, and SQL interop based on base-unit scalar values.
Example (Arithmetic) ¶
package main
import (
"fmt"
"github.com/nodivbyzero/quant"
)
func main() {
total := quant.New[quant.Length](750, quant.Meter).Add(quant.New[quant.Length](1.25, quant.Kilometer))
fmt.Printf("%.0f\n", total.To(quant.Meter))
}
Output: 2000
Example (LengthConversion) ¶
package main
import (
"fmt"
"github.com/nodivbyzero/quant"
)
func main() {
km := quant.New[quant.Length](3, quant.Mile).To(quant.Kilometer)
fmt.Printf("%.6f\n", km)
}
Output: 4.828032
Example (MassConversion) ¶
package main
import (
"fmt"
"github.com/nodivbyzero/quant"
)
func main() {
kg := quant.Amount[quant.Mass](10).From(quant.Pound).To(quant.Kilogram)
fmt.Printf("%.6f\n", kg)
}
Output: 4.535924
Index ¶
- Variables
- func Amount[D any](v float64) builder[D]
- type Acceleration
- type Acidity
- type Angle
- type ApparentPower
- type Area
- type Charge
- type Current
- type Digital
- type Div
- type ElectricalConductivity
- type Energy
- type Force
- type Frequency
- type Illuminance
- type Length
- type Mass
- type Mul
- type Pace
- type PartsPer
- type Pieces
- type Power
- type Pressure
- type Quantity
- func Acres(v float64) Quantity[Area]
- func Amperes(v float64) Quantity[Current]
- func ArcMinutes(v float64) Quantity[Angle]
- func ArcSeconds(v float64) Quantity[Angle]
- func BTUsPerSecond(v float64) Quantity[Power]
- func BakersDozens(v float64) Quantity[Pieces]
- func Bars(v float64) Quantity[Pressure]
- func Bits(v float64) Quantity[Digital]
- func Bytes(v float64) Quantity[Digital]
- func CentilitersPerSecond(v float64) Quantity[VolumeFlowRate]
- func Centimeters(v float64) Quantity[Length]
- func Centuries(v float64) Quantity[Time]
- func Coulombs(v float64) Quantity[Charge]
- func Couples(v float64) Quantity[Pieces]
- func CubicCentimeters(v float64) Quantity[Volume]
- func CubicCentimetersPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicFeet(v float64) Quantity[Volume]
- func CubicFeetPerHour(v float64) Quantity[VolumeFlowRate]
- func CubicFeetPerMinute(v float64) Quantity[VolumeFlowRate]
- func CubicFeetPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicInches(v float64) Quantity[Volume]
- func CubicInchesPerHour(v float64) Quantity[VolumeFlowRate]
- func CubicInchesPerMinute(v float64) Quantity[VolumeFlowRate]
- func CubicInchesPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicKilometers(v float64) Quantity[Volume]
- func CubicKilometersPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicMeters(v float64) Quantity[Volume]
- func CubicMetersPerHour(v float64) Quantity[VolumeFlowRate]
- func CubicMetersPerMinute(v float64) Quantity[VolumeFlowRate]
- func CubicMetersPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicMillimeters(v float64) Quantity[Volume]
- func CubicMillimetersPerSecond(v float64) Quantity[VolumeFlowRate]
- func CubicYards(v float64) Quantity[Volume]
- func CubicYardsPerHour(v float64) Quantity[VolumeFlowRate]
- func CubicYardsPerMinute(v float64) Quantity[VolumeFlowRate]
- func CubicYardsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Cups(v float64) Quantity[Volume]
- func CupsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Days(v float64) Quantity[Time]
- func Decades(v float64) Quantity[Time]
- func DecilitersPerSecond(v float64) Quantity[VolumeFlowRate]
- func Degrees(v float64) Quantity[Angle]
- func DegreesCelsius(v float64) Quantity[Temperature]
- func DegreesFahrenheit(v float64) Quantity[Temperature]
- func DegreesPerSecond(v float64) Quantity[Frequency]
- func DegreesRankine(v float64) Quantity[Temperature]
- func DozenDozens(v float64) Quantity[Pieces]
- func Dozens(v float64) Quantity[Pieces]
- func Fathoms(v float64) Quantity[Length]
- func Feet(v float64) Quantity[Length]
- func FeetPerSecond(v float64) Quantity[Speed]
- func FluidOunces(v float64) Quantity[Volume]
- func FluidOuncesPerHour(v float64) Quantity[VolumeFlowRate]
- func FluidOuncesPerMinute(v float64) Quantity[VolumeFlowRate]
- func FluidOuncesPerSecond(v float64) Quantity[VolumeFlowRate]
- func FootCandles(v float64) Quantity[Illuminance]
- func FootPoundForcePerSeconds(v float64) Quantity[Power]
- func GForces(v float64) Quantity[Acceleration]
- func Gallons(v float64) Quantity[Volume]
- func GallonsPerHour(v float64) Quantity[VolumeFlowRate]
- func GallonsPerMinute(v float64) Quantity[VolumeFlowRate]
- func GallonsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Gibibytes(v float64) Quantity[Digital]
- func GigaVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
- func GigaVoltAmpereReactives(v float64) Quantity[ReactivePower]
- func GigaVoltAmperes(v float64) Quantity[ApparentPower]
- func Gigabits(v float64) Quantity[Digital]
- func Gigabytes(v float64) Quantity[Digital]
- func Gigahertzes(v float64) Quantity[Frequency]
- func Gigajoules(v float64) Quantity[Energy]
- func Gigaliters(v float64) Quantity[Volume]
- func GigawattHours(v float64) Quantity[Energy]
- func Gigawatts(v float64) Quantity[Power]
- func Gradians(v float64) Quantity[Angle]
- func Grams(v float64) Quantity[Mass]
- func GreatGrosses(v float64) Quantity[Pieces]
- func Grosses(v float64) Quantity[Pieces]
- func HalfDozens(v float64) Quantity[Pieces]
- func Hectares(v float64) Quantity[Area]
- func Hectopascals(v float64) Quantity[Pressure]
- func Hertzes(v float64) Quantity[Frequency]
- func HorsepowerValues(v float64) Quantity[Power]
- func Hours(v float64) Quantity[Time]
- func Inches(v float64) Quantity[Length]
- func InchesPerHour(v float64) Quantity[Speed]
- func Joules(v float64) Quantity[Energy]
- func KSIs(v float64) Quantity[Pressure]
- func Kelvins(v float64) Quantity[Temperature]
- func Kibibytes(v float64) Quantity[Digital]
- func KiloVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
- func KiloVoltAmpereReactives(v float64) Quantity[ReactivePower]
- func KiloVoltAmperes(v float64) Quantity[ApparentPower]
- func Kiloamperes(v float64) Quantity[Current]
- func Kilobits(v float64) Quantity[Digital]
- func Kilobytes(v float64) Quantity[Digital]
- func Kilograms(v float64) Quantity[Mass]
- func KilogramsForce(v float64) Quantity[Force]
- func Kilohertzes(v float64) Quantity[Frequency]
- func Kilojoules(v float64) Quantity[Energy]
- func Kiloliters(v float64) Quantity[Volume]
- func KilolitersPerHour(v float64) Quantity[VolumeFlowRate]
- func KilolitersPerMinute(v float64) Quantity[VolumeFlowRate]
- func KilolitersPerSecond(v float64) Quantity[VolumeFlowRate]
- func Kilometers(v float64) Quantity[Length]
- func KilometersPerHour(v float64) Quantity[Speed]
- func Kilonewtons(v float64) Quantity[Force]
- func Kilopascals(v float64) Quantity[Pressure]
- func Kilovolts(v float64) Quantity[Voltage]
- func KilowattHours(v float64) Quantity[Energy]
- func Kilowatts(v float64) Quantity[Power]
- func Knots(v float64) Quantity[Speed]
- func Liters(v float64) Quantity[Volume]
- func LitersPerHour(v float64) Quantity[VolumeFlowRate]
- func LitersPerMinute(v float64) Quantity[VolumeFlowRate]
- func LitersPerSecond(v float64) Quantity[VolumeFlowRate]
- func LongHundreds(v float64) Quantity[Pieces]
- func Luxes(v float64) Quantity[Illuminance]
- func Mebibytes(v float64) Quantity[Digital]
- func MegaVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
- func MegaVoltAmpereReactives(v float64) Quantity[ReactivePower]
- func MegaVoltAmperes(v float64) Quantity[ApparentPower]
- func Megabits(v float64) Quantity[Digital]
- func Megabytes(v float64) Quantity[Digital]
- func Megahertzes(v float64) Quantity[Frequency]
- func Megajoules(v float64) Quantity[Energy]
- func Megaliters(v float64) Quantity[Volume]
- func Megapascals(v float64) Quantity[Pressure]
- func MegawattHours(v float64) Quantity[Energy]
- func Megawatts(v float64) Quantity[Power]
- func MeterPerHours(v float64) Quantity[Speed]
- func Meters(v float64) Quantity[Length]
- func MetersOfWater(v float64) Quantity[Pressure]
- func MetersPerSecond(v float64) Quantity[Speed]
- func MetersPerSecondSquared(v float64) Quantity[Acceleration]
- func MetricHorsepowerValues(v float64) Quantity[Power]
- func MetricTons(v float64) Quantity[Mass]
- func Microcoulombs(v float64) Quantity[Charge]
- func Micrograms(v float64) Quantity[Mass]
- func Micrometers(v float64) Quantity[Length]
- func Microseconds(v float64) Quantity[Time]
- func MicrosiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
- func MicrosiemensPerMeters(v float64) Quantity[ElectricalConductivity]
- func Miles(v float64) Quantity[Length]
- func MilesPerHour(v float64) Quantity[Speed]
- func MilliVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
- func MilliVoltAmpereReactives(v float64) Quantity[ReactivePower]
- func MilliVoltAmperes(v float64) Quantity[ApparentPower]
- func Milliamperes(v float64) Quantity[Current]
- func Millicoulombs(v float64) Quantity[Charge]
- func Milligrams(v float64) Quantity[Mass]
- func Millihertzes(v float64) Quantity[Frequency]
- func Milliliters(v float64) Quantity[Volume]
- func MillilitersPerSecond(v float64) Quantity[VolumeFlowRate]
- func Millimeters(v float64) Quantity[Length]
- func MillimetersOfMercury(v float64) Quantity[Pressure]
- func MillimetersPerHour(v float64) Quantity[Speed]
- func Milliseconds(v float64) Quantity[Time]
- func MillisiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
- func MillisiemensPerMeters(v float64) Quantity[ElectricalConductivity]
- func Millivolts(v float64) Quantity[Voltage]
- func MilliwattHours(v float64) Quantity[Energy]
- func Milliwatts(v float64) Quantity[Power]
- func Minutes(v float64) Quantity[Time]
- func MinutesPerKilometer(v float64) Quantity[Pace]
- func MinutesPerMile(v float64) Quantity[Pace]
- func Months(v float64) Quantity[Time]
- func Nanocoulombs(v float64) Quantity[Charge]
- func Nanometers(v float64) Quantity[Length]
- func Nanoseconds(v float64) Quantity[Time]
- func NauticalMiles(v float64) Quantity[Length]
- func New[D any, U Unit[D]](v float64, u U) Quantity[D]
- func NewtonMeters(v float64) Quantity[Torque]
- func Newtons(v float64) Quantity[Force]
- func Ounces(v float64) Quantity[Mass]
- func PHValue(v float64) Quantity[Acidity]
- func POHValue(v float64) Quantity[Acidity]
- func PSIs(v float64) Quantity[Pressure]
- func PartsPerBillion(v float64) Quantity[PartsPer]
- func PartsPerMillion(v float64) Quantity[PartsPer]
- func PartsPerQuadrillion(v float64) Quantity[PartsPer]
- func PartsPerTrillion(v float64) Quantity[PartsPer]
- func Pascals(v float64) Quantity[Pressure]
- func Petabytes(v float64) Quantity[Digital]
- func Picocoulombs(v float64) Quantity[Charge]
- func PiecesCount(v float64) Quantity[Pieces]
- func Pints(v float64) Quantity[Volume]
- func PintsPerHour(v float64) Quantity[VolumeFlowRate]
- func PintsPerMinute(v float64) Quantity[VolumeFlowRate]
- func PintsPerSecond(v float64) Quantity[VolumeFlowRate]
- func PoundForceFeet(v float64) Quantity[Torque]
- func Pounds(v float64) Quantity[Mass]
- func PoundsForce(v float64) Quantity[Force]
- func Quarts(v float64) Quantity[Volume]
- func QuartsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Radians(v float64) Quantity[Angle]
- func RadiansPerSecond(v float64) Quantity[Frequency]
- func Reams(v float64) Quantity[Pieces]
- func RevolutionsPerMinute(v float64) Quantity[Frequency]
- func Scores(v float64) Quantity[Pieces]
- func Seconds(v float64) Quantity[Time]
- func SecondsPerFoot(v float64) Quantity[Pace]
- func SecondsPerMeter(v float64) Quantity[Pace]
- func SiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
- func SiemensPerMeters(v float64) Quantity[ElectricalConductivity]
- func SmallGrosses(v float64) Quantity[Pieces]
- func SquareCentimeters(v float64) Quantity[Area]
- func SquareFeet(v float64) Quantity[Area]
- func SquareInches(v float64) Quantity[Area]
- func SquareKilometers(v float64) Quantity[Area]
- func SquareMeters(v float64) Quantity[Area]
- func SquareMiles(v float64) Quantity[Area]
- func SquareMillimeters(v float64) Quantity[Area]
- func StandardGravities(v float64) Quantity[Acceleration]
- func Stones(v float64) Quantity[Mass]
- func Tablespoons(v float64) Quantity[Volume]
- func TablespoonsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Teaspoons(v float64) Quantity[Volume]
- func TeaspoonsPerSecond(v float64) Quantity[VolumeFlowRate]
- func Tebibytes(v float64) Quantity[Digital]
- func Terabits(v float64) Quantity[Digital]
- func Terabytes(v float64) Quantity[Digital]
- func Terahertzes(v float64) Quantity[Frequency]
- func Tonnes(v float64) Quantity[Mass]
- func Torrs(v float64) Quantity[Pressure]
- func Trios(v float64) Quantity[Pieces]
- func USFeet(v float64) Quantity[Length]
- func VoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
- func VoltAmpereReactives(v float64) Quantity[ReactivePower]
- func VoltAmperes(v float64) Quantity[ApparentPower]
- func Volts(v float64) Quantity[Voltage]
- func WattHours(v float64) Quantity[Energy]
- func WattMinutes(v float64) Quantity[Energy]
- func WattSeconds(v float64) Quantity[Energy]
- func Watts(v float64) Quantity[Power]
- func Weeks(v float64) Quantity[Time]
- func Yards(v float64) Quantity[Length]
- func Years(v float64) Quantity[Time]
- func (q Quantity[D]) Add(other Quantity[D]) Quantity[D]
- func (q Quantity[Length]) Div(other Quantity[Time]) Quantity[Speed]
- func (q Quantity[Speed]) DivSpeed(other Quantity[Time]) Quantity[Acceleration]
- func (q Quantity[D]) Format(u Unit[D]) string
- func (q Quantity[D]) MarshalJSON() ([]byte, error)
- func (q Quantity[D]) MarshalText() ([]byte, error)
- func (q Quantity[D]) String() string
- func (q Quantity[D]) Sub(other Quantity[D]) Quantity[D]
- func (q Quantity[D]) To(u Unit[D]) float64
- func (q *Quantity[D]) UnmarshalJSON(data []byte) error
- func (q *Quantity[D]) UnmarshalText(text []byte) error
- func (q Quantity[D]) Value(u Unit[D]) float64
- type ReactiveEnergy
- type ReactivePower
- type SQLQuantity
- type Speed
- type Temperature
- type Time
- type Torque
- type Unit
- type Voltage
- type Volume
- type VolumeFlowRate
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( MeterPerSecondSquared = scaleUnit[Acceleration]{/* contains filtered or unexported fields */} GForce = scaleUnit[Acceleration]{/* contains filtered or unexported fields */} StandardGravity = scaleUnit[Acceleration]{/* contains filtered or unexported fields */} )
Acceleration units.
var ( PH = scaleUnit[Acidity]{/* contains filtered or unexported fields */} POH = affineUnit[Acidity]{/* contains filtered or unexported fields */} )
Acidity units.
var ( Radian = scaleUnit[Angle]{/* contains filtered or unexported fields */} Degree = scaleUnit[Angle]{/* contains filtered or unexported fields */} Gradian = scaleUnit[Angle]{/* contains filtered or unexported fields */} ArcMinute = scaleUnit[Angle]{/* contains filtered or unexported fields */} ArcSecond = scaleUnit[Angle]{/* contains filtered or unexported fields */} )
Angle units.
var ( SquareMillimeter = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareCentimeter = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareMeter = scaleUnit[Area]{/* contains filtered or unexported fields */} Hectare = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareKilometer = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareInch = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareFoot = scaleUnit[Area]{/* contains filtered or unexported fields */} Acre = scaleUnit[Area]{/* contains filtered or unexported fields */} SquareMile = scaleUnit[Area]{/* contains filtered or unexported fields */} )
Area units.
var ( Coulomb = scaleUnit[Charge]{/* contains filtered or unexported fields */} Millicoulomb = scaleUnit[Charge]{/* contains filtered or unexported fields */} Microcoulomb = scaleUnit[Charge]{/* contains filtered or unexported fields */} Nanocoulomb = scaleUnit[Charge]{/* contains filtered or unexported fields */} Picocoulomb = scaleUnit[Charge]{/* contains filtered or unexported fields */} )
Charge units.
var ( Bit = scaleUnit[Digital]{/* contains filtered or unexported fields */} Kilobit = scaleUnit[Digital]{/* contains filtered or unexported fields */} Megabit = scaleUnit[Digital]{/* contains filtered or unexported fields */} Gigabit = scaleUnit[Digital]{/* contains filtered or unexported fields */} Terabit = scaleUnit[Digital]{/* contains filtered or unexported fields */} Byte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Kilobyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Megabyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Gigabyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Terabyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Petabyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Kibibyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Mebibyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Gibibyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} Tebibyte = scaleUnit[Digital]{/* contains filtered or unexported fields */} )
Digital units.
var ( Volt = scaleUnit[Voltage]{/* contains filtered or unexported fields */} Millivolt = scaleUnit[Voltage]{/* contains filtered or unexported fields */} Kilovolt = scaleUnit[Voltage]{/* contains filtered or unexported fields */} )
Voltage units.
var ( Ampere = scaleUnit[Current]{/* contains filtered or unexported fields */} Milliampere = scaleUnit[Current]{/* contains filtered or unexported fields */} Kiloampere = scaleUnit[Current]{/* contains filtered or unexported fields */} )
Current units.
var ( Watt = scaleUnit[Power]{/* contains filtered or unexported fields */} Milliwatt = scaleUnit[Power]{/* contains filtered or unexported fields */} Kilowatt = scaleUnit[Power]{/* contains filtered or unexported fields */} Megawatt = scaleUnit[Power]{/* contains filtered or unexported fields */} Gigawatt = scaleUnit[Power]{/* contains filtered or unexported fields */} MetricHorsepower = scaleUnit[Power]{/* contains filtered or unexported fields */} BTUPerSecond = scaleUnit[Power]{/* contains filtered or unexported fields */} FootPoundForcePerSecond = scaleUnit[Power]{/* contains filtered or unexported fields */} Horsepower = scaleUnit[Power]{/* contains filtered or unexported fields */} )
Power units.
var ( VoltAmpere = scaleUnit[ApparentPower]{/* contains filtered or unexported fields */} MilliVoltAmpere = scaleUnit[ApparentPower]{/* contains filtered or unexported fields */} KiloVoltAmpere = scaleUnit[ApparentPower]{/* contains filtered or unexported fields */} MegaVoltAmpere = scaleUnit[ApparentPower]{/* contains filtered or unexported fields */} GigaVoltAmpere = scaleUnit[ApparentPower]{/* contains filtered or unexported fields */} )
Apparent power units.
var ( VoltAmpereReactive = scaleUnit[ReactivePower]{/* contains filtered or unexported fields */} MilliVoltAmpereReactive = scaleUnit[ReactivePower]{/* contains filtered or unexported fields */} KiloVoltAmpereReactive = scaleUnit[ReactivePower]{/* contains filtered or unexported fields */} MegaVoltAmpereReactive = scaleUnit[ReactivePower]{/* contains filtered or unexported fields */} GigaVoltAmpereReactive = scaleUnit[ReactivePower]{/* contains filtered or unexported fields */} )
Reactive power units.
var ( SiemensPerMeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} MillisiemensPerMeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} MicrosiemensPerMeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} SiemensPerCentimeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} MillisiemensPerCentimeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} MicrosiemensPerCentimeter = scaleUnit[ElectricalConductivity]{/* contains filtered or unexported fields */} )
Electrical conductivity units.
var ( Joule = scaleUnit[Energy]{/* contains filtered or unexported fields */} Kilojoule = scaleUnit[Energy]{/* contains filtered or unexported fields */} Megajoule = scaleUnit[Energy]{/* contains filtered or unexported fields */} Gigajoule = scaleUnit[Energy]{/* contains filtered or unexported fields */} WattSecond = scaleUnit[Energy]{/* contains filtered or unexported fields */} WattMinute = scaleUnit[Energy]{/* contains filtered or unexported fields */} MilliwattHour = scaleUnit[Energy]{/* contains filtered or unexported fields */} WattHour = scaleUnit[Energy]{/* contains filtered or unexported fields */} KilowattHour = scaleUnit[Energy]{/* contains filtered or unexported fields */} MegawattHour = scaleUnit[Energy]{/* contains filtered or unexported fields */} GigawattHour = scaleUnit[Energy]{/* contains filtered or unexported fields */} )
Energy units.
var ( VoltAmpereReactiveHour = scaleUnit[ReactiveEnergy]{/* contains filtered or unexported fields */} MilliVoltAmpereReactiveHour = scaleUnit[ReactiveEnergy]{/* contains filtered or unexported fields */} KiloVoltAmpereReactiveHour = scaleUnit[ReactiveEnergy]{/* contains filtered or unexported fields */} MegaVoltAmpereReactiveHour = scaleUnit[ReactiveEnergy]{/* contains filtered or unexported fields */} GigaVoltAmpereReactiveHour = scaleUnit[ReactiveEnergy]{/* contains filtered or unexported fields */} )
Reactive energy units.
var ( Newton = scaleUnit[Force]{/* contains filtered or unexported fields */} Kilonewton = scaleUnit[Force]{/* contains filtered or unexported fields */} PoundForce = scaleUnit[Force]{/* contains filtered or unexported fields */} KilogramForce = scaleUnit[Force]{/* contains filtered or unexported fields */} )
Force units.
var ( Hertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} Millihertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} Kilohertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} Megahertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} Gigahertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} Terahertz = scaleUnit[Frequency]{/* contains filtered or unexported fields */} RevolutionPerMinute = scaleUnit[Frequency]{/* contains filtered or unexported fields */} DegreePerSecond = scaleUnit[Frequency]{/* contains filtered or unexported fields */} RadianPerSecond = scaleUnit[Frequency]{/* contains filtered or unexported fields */} )
Frequency units.
var ( Lux = scaleUnit[Illuminance]{/* contains filtered or unexported fields */} FootCandle = scaleUnit[Illuminance]{/* contains filtered or unexported fields */} )
Illuminance units.
var ( Nanometer = scaleUnit[Length]{/* contains filtered or unexported fields */} Micrometer = scaleUnit[Length]{/* contains filtered or unexported fields */} Millimeter = scaleUnit[Length]{/* contains filtered or unexported fields */} Centimeter = scaleUnit[Length]{/* contains filtered or unexported fields */} Meter = scaleUnit[Length]{/* contains filtered or unexported fields */} Inch = scaleUnit[Length]{/* contains filtered or unexported fields */} Yard = scaleUnit[Length]{/* contains filtered or unexported fields */} USFoot = scaleUnit[Length]{/* contains filtered or unexported fields */} Foot = scaleUnit[Length]{/* contains filtered or unexported fields */} Fathom = scaleUnit[Length]{/* contains filtered or unexported fields */} Kilometer = scaleUnit[Length]{/* contains filtered or unexported fields */} Mile = scaleUnit[Length]{/* contains filtered or unexported fields */} NauticalMile = scaleUnit[Length]{/* contains filtered or unexported fields */} )
Length units.
var ( Microgram = scaleUnit[Mass]{/* contains filtered or unexported fields */} Milligram = scaleUnit[Mass]{/* contains filtered or unexported fields */} Gram = scaleUnit[Mass]{/* contains filtered or unexported fields */} Kilogram = scaleUnit[Mass]{/* contains filtered or unexported fields */} Ounce = scaleUnit[Mass]{/* contains filtered or unexported fields */} Pound = scaleUnit[Mass]{/* contains filtered or unexported fields */} Stone = scaleUnit[Mass]{/* contains filtered or unexported fields */} MetricTon = scaleUnit[Mass]{/* contains filtered or unexported fields */} Tonne = scaleUnit[Mass]{/* contains filtered or unexported fields */} )
Mass units.
var ( SecondPerMeter = scaleUnit[Pace]{/* contains filtered or unexported fields */} MinutePerKilometer = scaleUnit[Pace]{/* contains filtered or unexported fields */} SecondPerFoot = scaleUnit[Pace]{/* contains filtered or unexported fields */} MinutePerMile = scaleUnit[Pace]{/* contains filtered or unexported fields */} )
Pace units.
var ( Ratio = scaleUnit[PartsPer]{/* contains filtered or unexported fields */} PPM = scaleUnit[PartsPer]{/* contains filtered or unexported fields */} PPB = scaleUnit[PartsPer]{/* contains filtered or unexported fields */} PPT = scaleUnit[PartsPer]{/* contains filtered or unexported fields */} PPQ = scaleUnit[PartsPer]{/* contains filtered or unexported fields */} )
Parts-per units.
var ( Piece = scaleUnit[Pieces]{/* contains filtered or unexported fields */} BakersDozen = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Couple = scaleUnit[Pieces]{/* contains filtered or unexported fields */} DozenDozen = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Dozen = scaleUnit[Pieces]{/* contains filtered or unexported fields */} GreatGross = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Gross = scaleUnit[Pieces]{/* contains filtered or unexported fields */} HalfDozen = scaleUnit[Pieces]{/* contains filtered or unexported fields */} LongHundred = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Ream = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Score = scaleUnit[Pieces]{/* contains filtered or unexported fields */} SmallGross = scaleUnit[Pieces]{/* contains filtered or unexported fields */} Trio = scaleUnit[Pieces]{/* contains filtered or unexported fields */} )
Pieces units.
var ( Pascal = scaleUnit[Pressure]{/* contains filtered or unexported fields */} Hectopascal = scaleUnit[Pressure]{/* contains filtered or unexported fields */} Kilopascal = scaleUnit[Pressure]{/* contains filtered or unexported fields */} Megapascal = scaleUnit[Pressure]{/* contains filtered or unexported fields */} Bar = scaleUnit[Pressure]{/* contains filtered or unexported fields */} Torr = scaleUnit[Pressure]{/* contains filtered or unexported fields */} MeterOfWater = scaleUnit[Pressure]{/* contains filtered or unexported fields */} MillimeterOfMercury = scaleUnit[Pressure]{/* contains filtered or unexported fields */} PSI = scaleUnit[Pressure]{/* contains filtered or unexported fields */} KSI = scaleUnit[Pressure]{/* contains filtered or unexported fields */} )
Pressure units.
var ( MeterPerSecond = scaleUnit[Speed]{/* contains filtered or unexported fields */} KilometerPerHour = scaleUnit[Speed]{/* contains filtered or unexported fields */} MilePerHour = scaleUnit[Speed]{/* contains filtered or unexported fields */} MeterPerHour = scaleUnit[Speed]{/* contains filtered or unexported fields */} Knot = scaleUnit[Speed]{/* contains filtered or unexported fields */} FootPerSecond = scaleUnit[Speed]{/* contains filtered or unexported fields */} InchPerHour = scaleUnit[Speed]{/* contains filtered or unexported fields */} MillimeterPerHour = scaleUnit[Speed]{/* contains filtered or unexported fields */} )
Speed units.
var ( Kelvin = affineUnit[Temperature]{/* contains filtered or unexported fields */} Celsius = affineUnit[Temperature]{/* contains filtered or unexported fields */} Fahrenheit = affineUnit[Temperature]{/* contains filtered or unexported fields */} Rankine = affineUnit[Temperature]{/* contains filtered or unexported fields */} )
Temperature units.
var ( Nanosecond = scaleUnit[Time]{/* contains filtered or unexported fields */} Microsecond = scaleUnit[Time]{/* contains filtered or unexported fields */} Millisecond = scaleUnit[Time]{/* contains filtered or unexported fields */} Second = scaleUnit[Time]{/* contains filtered or unexported fields */} Minute = scaleUnit[Time]{/* contains filtered or unexported fields */} Hour = scaleUnit[Time]{/* contains filtered or unexported fields */} Day = scaleUnit[Time]{/* contains filtered or unexported fields */} Week = scaleUnit[Time]{/* contains filtered or unexported fields */} Month = scaleUnit[Time]{/* contains filtered or unexported fields */} Year = scaleUnit[Time]{/* contains filtered or unexported fields */} Decade = scaleUnit[Time]{/* contains filtered or unexported fields */} Century = scaleUnit[Time]{/* contains filtered or unexported fields */} )
Time units.
var ( NewtonMeter = scaleUnit[Torque]{/* contains filtered or unexported fields */} PoundForceFoot = scaleUnit[Torque]{/* contains filtered or unexported fields */} )
Torque units.
var ( CubicMillimeter = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicCentimeter = scaleUnit[Volume]{/* contains filtered or unexported fields */} Milliliter = scaleUnit[Volume]{/* contains filtered or unexported fields */} Liter = scaleUnit[Volume]{/* contains filtered or unexported fields */} Kiloliter = scaleUnit[Volume]{/* contains filtered or unexported fields */} Megaliter = scaleUnit[Volume]{/* contains filtered or unexported fields */} Gigaliter = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicMeter = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicKilometer = scaleUnit[Volume]{/* contains filtered or unexported fields */} Teaspoon = scaleUnit[Volume]{/* contains filtered or unexported fields */} Tablespoon = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicInch = scaleUnit[Volume]{/* contains filtered or unexported fields */} FluidOunce = scaleUnit[Volume]{/* contains filtered or unexported fields */} Cup = scaleUnit[Volume]{/* contains filtered or unexported fields */} Pint = scaleUnit[Volume]{/* contains filtered or unexported fields */} Quart = scaleUnit[Volume]{/* contains filtered or unexported fields */} Gallon = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicFoot = scaleUnit[Volume]{/* contains filtered or unexported fields */} CubicYard = scaleUnit[Volume]{/* contains filtered or unexported fields */} )
Volume units.
var ( CubicMillimeterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicCentimeterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} MilliliterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CentiliterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} DeciliterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} LiterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} LiterPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} LiterPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} KiloliterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} KiloliterPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} KiloliterPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicMeterPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicMeterPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicMeterPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicKilometerPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} TeaspoonPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} TablespoonPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicInchPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicInchPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicInchPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} FluidOuncePerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} FluidOuncePerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} FluidOuncePerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CupPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} PintPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} PintPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} PintPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} QuartPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} GallonPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} GallonPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} GallonPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicFootPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicFootPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicFootPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicYardPerSecond = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicYardPerMinute = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} CubicYardPerHour = scaleUnit[VolumeFlowRate]{/* contains filtered or unexported fields */} )
Volume flow rate units.
Functions ¶
Types ¶
type Acceleration ¶
Acceleration is the derived dimension for speed divided by time.
type Acidity ¶ added in v1.0.1
type Acidity struct{}
Acidity is the dimension marker for acidity quantities.
PH is the base unit. POH conversions use the standard 25 C relationship: pH + pOH = 14.
type ApparentPower ¶
type ApparentPower struct{}
ApparentPower is the dimension marker for apparent power quantities.
type Current ¶
type Current struct{}
Current is the dimension marker for electrical current quantities.
type Digital ¶
type Digital struct{}
Digital is the dimension marker for digital information quantities.
type Div ¶
type Div[A, B any] struct{}
Div is a phantom dimension representing the quotient of two dimensions.
type ElectricalConductivity ¶ added in v1.0.1
type ElectricalConductivity struct{}
ElectricalConductivity is the dimension marker for electrical conductivity quantities.
type Frequency ¶
type Frequency struct{}
Frequency is the dimension marker for frequency-like quantities.
type Illuminance ¶
type Illuminance struct{}
Illuminance is the dimension marker for illuminance quantities.
type Mul ¶
type Mul[A, B any] struct{}
Mul is a phantom dimension representing the product of two dimensions.
type Quantity ¶
type Quantity[D any] struct { // contains filtered or unexported fields }
Quantity stores a physical quantity in the base unit for its dimension.
The dimension type parameter is a phantom type used only for compile-time safety.
func ArcMinutes ¶
func ArcSeconds ¶
func BTUsPerSecond ¶
func BakersDozens ¶
func CentilitersPerSecond ¶
func CentilitersPerSecond(v float64) Quantity[VolumeFlowRate]
func Centimeters ¶
func CubicCentimeters ¶
func CubicCentimetersPerSecond ¶
func CubicCentimetersPerSecond(v float64) Quantity[VolumeFlowRate]
func CubicFeetPerHour ¶
func CubicFeetPerHour(v float64) Quantity[VolumeFlowRate]
func CubicFeetPerMinute ¶
func CubicFeetPerMinute(v float64) Quantity[VolumeFlowRate]
func CubicFeetPerSecond ¶
func CubicFeetPerSecond(v float64) Quantity[VolumeFlowRate]
func CubicInches ¶
func CubicInchesPerHour ¶
func CubicInchesPerHour(v float64) Quantity[VolumeFlowRate]
func CubicInchesPerMinute ¶
func CubicInchesPerMinute(v float64) Quantity[VolumeFlowRate]
func CubicInchesPerSecond ¶
func CubicInchesPerSecond(v float64) Quantity[VolumeFlowRate]
func CubicKilometers ¶
func CubicKilometersPerSecond ¶
func CubicKilometersPerSecond(v float64) Quantity[VolumeFlowRate]
func CubicMeters ¶
func CubicMetersPerHour ¶
func CubicMetersPerHour(v float64) Quantity[VolumeFlowRate]
func CubicMetersPerMinute ¶
func CubicMetersPerMinute(v float64) Quantity[VolumeFlowRate]
func CubicMetersPerSecond ¶
func CubicMetersPerSecond(v float64) Quantity[VolumeFlowRate]
func CubicMillimetersPerSecond ¶
func CubicMillimetersPerSecond(v float64) Quantity[VolumeFlowRate]
Volume flow rate constructors.
func CubicYards ¶
func CubicYardsPerHour ¶
func CubicYardsPerHour(v float64) Quantity[VolumeFlowRate]
func CubicYardsPerMinute ¶
func CubicYardsPerMinute(v float64) Quantity[VolumeFlowRate]
func CubicYardsPerSecond ¶
func CubicYardsPerSecond(v float64) Quantity[VolumeFlowRate]
func CupsPerSecond ¶
func CupsPerSecond(v float64) Quantity[VolumeFlowRate]
func DecilitersPerSecond ¶
func DecilitersPerSecond(v float64) Quantity[VolumeFlowRate]
func DegreesCelsius ¶
func DegreesCelsius(v float64) Quantity[Temperature]
Temperature constructors.
func DegreesFahrenheit ¶
func DegreesFahrenheit(v float64) Quantity[Temperature]
func DegreesPerSecond ¶
func DegreesRankine ¶
func DegreesRankine(v float64) Quantity[Temperature]
func DozenDozens ¶
func FeetPerSecond ¶
func FluidOunces ¶
func FluidOuncesPerHour ¶
func FluidOuncesPerHour(v float64) Quantity[VolumeFlowRate]
func FluidOuncesPerMinute ¶
func FluidOuncesPerMinute(v float64) Quantity[VolumeFlowRate]
func FluidOuncesPerSecond ¶
func FluidOuncesPerSecond(v float64) Quantity[VolumeFlowRate]
func FootCandles ¶
func FootCandles(v float64) Quantity[Illuminance]
func GForces ¶
func GForces(v float64) Quantity[Acceleration]
func GallonsPerHour ¶
func GallonsPerHour(v float64) Quantity[VolumeFlowRate]
func GallonsPerMinute ¶
func GallonsPerMinute(v float64) Quantity[VolumeFlowRate]
func GallonsPerSecond ¶
func GallonsPerSecond(v float64) Quantity[VolumeFlowRate]
func GigaVoltAmpereReactiveHours ¶
func GigaVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
func GigaVoltAmpereReactives ¶
func GigaVoltAmpereReactives(v float64) Quantity[ReactivePower]
func GigaVoltAmperes ¶
func GigaVoltAmperes(v float64) Quantity[ApparentPower]
func Gigahertzes ¶
func Gigajoules ¶
func Gigaliters ¶
func GigawattHours ¶
func GreatGrosses ¶
func HalfDozens ¶
func Hectopascals ¶
func HorsepowerValues ¶
func InchesPerHour ¶
func Kelvins ¶
func Kelvins(v float64) Quantity[Temperature]
func KiloVoltAmpereReactiveHours ¶
func KiloVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
func KiloVoltAmpereReactives ¶
func KiloVoltAmpereReactives(v float64) Quantity[ReactivePower]
func KiloVoltAmperes ¶
func KiloVoltAmperes(v float64) Quantity[ApparentPower]
func Kiloamperes ¶
func KilogramsForce ¶
func Kilohertzes ¶
func Kilojoules ¶
func Kiloliters ¶
func KilolitersPerHour ¶
func KilolitersPerHour(v float64) Quantity[VolumeFlowRate]
func KilolitersPerMinute ¶
func KilolitersPerMinute(v float64) Quantity[VolumeFlowRate]
func KilolitersPerSecond ¶
func KilolitersPerSecond(v float64) Quantity[VolumeFlowRate]
func Kilometers ¶
func KilometersPerHour ¶
func Kilonewtons ¶
func Kilopascals ¶
func KilowattHours ¶
func LitersPerHour ¶
func LitersPerHour(v float64) Quantity[VolumeFlowRate]
func LitersPerMinute ¶
func LitersPerMinute(v float64) Quantity[VolumeFlowRate]
func LitersPerSecond ¶
func LitersPerSecond(v float64) Quantity[VolumeFlowRate]
func LongHundreds ¶
func MegaVoltAmpereReactiveHours ¶
func MegaVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
func MegaVoltAmpereReactives ¶
func MegaVoltAmpereReactives(v float64) Quantity[ReactivePower]
func MegaVoltAmperes ¶
func MegaVoltAmperes(v float64) Quantity[ApparentPower]
func Megahertzes ¶
func Megajoules ¶
func Megaliters ¶
func Megapascals ¶
func MegawattHours ¶
func MeterPerHours ¶
func MetersOfWater ¶
func MetersPerSecondSquared ¶
func MetersPerSecondSquared(v float64) Quantity[Acceleration]
Acceleration constructors.
func MetricHorsepowerValues ¶
func MetricTons ¶
func Microcoulombs ¶
func Micrometers ¶
func Microseconds ¶
func MicrosiemensPerCentimeters ¶ added in v1.0.1
func MicrosiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
func MicrosiemensPerMeters ¶ added in v1.0.1
func MicrosiemensPerMeters(v float64) Quantity[ElectricalConductivity]
func MilesPerHour ¶
func MilliVoltAmpereReactiveHours ¶
func MilliVoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
func MilliVoltAmpereReactives ¶
func MilliVoltAmpereReactives(v float64) Quantity[ReactivePower]
func MilliVoltAmperes ¶
func MilliVoltAmperes(v float64) Quantity[ApparentPower]
func Milliamperes ¶
func Millicoulombs ¶
func Milligrams ¶
func Millihertzes ¶
func Milliliters ¶
func MillilitersPerSecond ¶
func MillilitersPerSecond(v float64) Quantity[VolumeFlowRate]
func Millimeters ¶
func MillimetersOfMercury ¶
func MillimetersPerHour ¶
func Milliseconds ¶
func MillisiemensPerCentimeters ¶ added in v1.0.1
func MillisiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
func MillisiemensPerMeters ¶ added in v1.0.1
func MillisiemensPerMeters(v float64) Quantity[ElectricalConductivity]
func Millivolts ¶
func MilliwattHours ¶
func Milliwatts ¶
func MinutesPerKilometer ¶
func MinutesPerMile ¶
func Nanocoulombs ¶
func NauticalMiles ¶
func PartsPerBillion ¶
func PartsPerQuadrillion ¶
func PartsPerTrillion ¶
func Picocoulombs ¶
func PintsPerHour ¶
func PintsPerHour(v float64) Quantity[VolumeFlowRate]
func PintsPerMinute ¶
func PintsPerMinute(v float64) Quantity[VolumeFlowRate]
func PintsPerSecond ¶
func PintsPerSecond(v float64) Quantity[VolumeFlowRate]
func PoundForceFeet ¶
func PoundsForce ¶
func QuartsPerSecond ¶
func QuartsPerSecond(v float64) Quantity[VolumeFlowRate]
func RadiansPerSecond ¶
func RevolutionsPerMinute ¶
func SecondsPerFoot ¶
func SiemensPerCentimeters ¶ added in v1.0.1
func SiemensPerCentimeters(v float64) Quantity[ElectricalConductivity]
func SiemensPerMeters ¶ added in v1.0.1
func SiemensPerMeters(v float64) Quantity[ElectricalConductivity]
Electrical conductivity constructors.
func SmallGrosses ¶
func SquareCentimeters ¶
func SquareFeet ¶
func SquareInches ¶
func SquareKilometers ¶
func SquareMeters ¶
func SquareMiles ¶
func StandardGravities ¶
func StandardGravities(v float64) Quantity[Acceleration]
func Tablespoons ¶
func TablespoonsPerSecond ¶
func TablespoonsPerSecond(v float64) Quantity[VolumeFlowRate]
func TeaspoonsPerSecond ¶
func TeaspoonsPerSecond(v float64) Quantity[VolumeFlowRate]
func Terahertzes ¶
func VoltAmpereReactiveHours ¶
func VoltAmpereReactiveHours(v float64) Quantity[ReactiveEnergy]
func VoltAmpereReactives ¶
func VoltAmpereReactives(v float64) Quantity[ReactivePower]
func VoltAmperes ¶
func VoltAmperes(v float64) Quantity[ApparentPower]
func WattMinutes ¶
func (Quantity[Speed]) DivSpeed ¶
func (q Quantity[Speed]) DivSpeed(other Quantity[Time]) Quantity[Acceleration]
DivSpeed divides a speed quantity by a time quantity and returns acceleration.
func (Quantity[D]) MarshalJSON ¶
MarshalJSON encodes the quantity as its scalar value in the base unit for the dimension.
func (Quantity[D]) MarshalText ¶
MarshalText encodes the quantity as a base-unit scalar value.
func (*Quantity[D]) UnmarshalJSON ¶
UnmarshalJSON decodes a quantity from a scalar value in the base unit for the dimension.
func (*Quantity[D]) UnmarshalText ¶
UnmarshalText decodes a base-unit scalar value into the quantity.
type ReactiveEnergy ¶
type ReactiveEnergy struct{}
ReactiveEnergy is the dimension marker for reactive energy quantities.
type ReactivePower ¶
type ReactivePower struct{}
ReactivePower is the dimension marker for reactive power quantities.
type SQLQuantity ¶
SQLQuantity wraps a quantity for database/sql interop using base-unit scalar values.
func SQL ¶
func SQL[D any](q Quantity[D]) SQLQuantity[D]
SQL wraps a quantity in a database-friendly adapter.
func (*SQLQuantity[D]) Scan ¶
func (q *SQLQuantity[D]) Scan(src any) error
Scan implements database/sql.Scanner using a base-unit scalar value.
type Temperature ¶
type Temperature struct{}
Temperature is the dimension marker for temperature quantities.
type Unit ¶
type Unit[D any] interface { // contains filtered or unexported methods }
Unit converts values between a unit and the base unit for a dimension.
Implementations should be small value types so conversions stay allocation-free and inline well.
type Voltage ¶
type Voltage struct{}
Voltage is the dimension marker for electrical potential quantities.
type VolumeFlowRate ¶
type VolumeFlowRate struct{}
VolumeFlowRate is the dimension marker for volumetric flow rate quantities.
Source Files
¶
- acceleration.go
- acidity.go
- angle.go
- area.go
- builder.go
- charge.go
- constructors.go
- derived.go
- digital.go
- doc.go
- electrical.go
- electrical_conductivity.go
- energy.go
- force.go
- frequency.go
- illuminance.go
- length.go
- mass.go
- pace.go
- parts_per.go
- pieces.go
- pressure.go
- quantity.go
- speed.go
- temperature.go
- time.go
- torque.go
- unit.go
- volume.go
- volume_flow_rate.go