ucum

package
v0.0.0-...-9f630e6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvBigInt

func ConvBigInt(from, to Unit, val *big.Int) (result *big.Int, exact bool, err error)

Types

type PairConverter

type PairConverter struct {
	// contains filtered or unexported fields
}

PairConverter makes conversion between two UCUM units.

func NewPairConverter

func NewPairConverter(from, to Unit) (*PairConverter, error)

NewPairConverter creates a new PairConverter.

func (*PairConverter) ConvBigInt

func (c *PairConverter) ConvBigInt(val *big.Int) (converted *big.Int, exact bool)

func (*PairConverter) ConvFloat64

func (c *PairConverter) ConvFloat64(val float64) float64

func (*PairConverter) ConvRat

func (c *PairConverter) ConvRat(val *big.Rat) *big.Rat

type Unit

type Unit struct {
	// contains filtered or unexported fields
}

Unit is a UCUM unit of measure.

func MustParse

func MustParse(unit []byte) Unit

func Normalize

func Normalize(unit Unit) Unit

Normalize builds a normalized version of the given unit. Normalized unit consists of a base units only.

func Parse

func Parse(unit []byte) (Unit, error)

func (*Unit) MarshalJSON

func (u *Unit) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Unit) String

func (u *Unit) String() string

func (*Unit) UnmarshalJSON

func (u *Unit) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Directories

Path Synopsis
internal
data
Code generated; DO NOT EDIT.
Code generated; DO NOT EDIT.

Jump to

Keyboard shortcuts

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