ucum

package module
v0.0.0-...-6b322a6 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: BSD-2-Clause Imports: 12 Imported by: 0

README

Ucum-Golang Version 0.9.4.beta

Golang library providing UCUM Services

(inspired by Grahame Grieve's UCUM Java library: https://github.com/FHIR/Ucum-java )

The library provides a set of services around UCUM:

  • validate a UCUM unit (and also against a particular base unit)
  • decide whether one unit can be converted/compared to another
  • translate a quantity from one unit to another
  • prepare a human readable display of a unit
  • multiply 2 quantities together

To use the library, download the definitionFile: ucum-essence.xml from http://unitsofmeasure.org, and then create a UCUMEssenceService:

ucumSvc = NewUcumEssenceService(definitionFile);

Please find the library-API in the file Ucum.go

  • Status: all API tests run fine.

Documentation

Index

Constants

View Source
const NO_CHAR = 0
View Source
const UCUM_OID = "2.16.840.1.113883.6.8"

UcumEssenceService=======================================================

Variables

This section is empty.

Functions

func ComposeExpression

func ComposeExpression(item interface{}, canonicalValue bool) string

func ComposeFormalStructure

func ComposeFormalStructure(term *Term) string

func IsAsciiChar

func IsAsciiChar(ch rune) bool

func IsDecimal

func IsDecimal(value string) bool

func IsInteger

func IsInteger(value string) bool

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func PadLeft

func PadLeft(src string, c rune, l int) string

Types

type BaseUnit

type BaseUnit struct {
	Unit
	Dim rune
}

BaseUnit===================================================== Parent is Unit DIM is character indicating the Property

func NewBaseUnit

func NewBaseUnit(code string, codeUC string) (*BaseUnit, error)

type ByCode

type ByCode []*CanonicalUnit

func (ByCode) Len

func (a ByCode) Len() int

func (ByCode) Less

func (a ByCode) Less(i, j int) bool

func (ByCode) Swap

func (a ByCode) Swap(i, j int)

type Canonical

type Canonical struct {
	Units []*CanonicalUnit
	Value decimal.Decimal
}

Canonical===================================================== * unit terms that are commonly used in medicine. Since the space of possible unit terms is infinite in theory and very large in practice, no attempt has been made on a systematic coverage of possible units. All necessary units can be built from the rules of The Unified Code for Units of Measure and there is no need of a particular term to be enumerated in order to be valid.

The canonical form itself consists of 3 columns: (4.1) the magnitude value of the unit term in terms of the canonical unit; (4.2) a canonical unit term; (4.3) if applicable a special conversion function code.

A canonical unit is a unit of measurement agreed upon as default in a certain context.

func NewCanonical

func NewCanonical(value decimal.Decimal) (*Canonical, error)

func (*Canonical) DivideValueDecimal

func (c *Canonical) DivideValueDecimal(divisor decimal.Decimal)

func (*Canonical) DivideValueInt

func (c *Canonical) DivideValueInt(divisor int)

func (*Canonical) MultiplyValueDecimal

func (c *Canonical) MultiplyValueDecimal(multiplicand decimal.Decimal)

func (*Canonical) MultiplyValueInt

func (c *Canonical) MultiplyValueInt(multiplicand int)

func (*Canonical) RemoveFromUnits

func (c *Canonical) RemoveFromUnits(i int)

func (*Canonical) SortUnits

func (c *Canonical) SortUnits()

type CanonicalUnit

type CanonicalUnit struct {
	Base     *BaseUnit
	Exponent int
}

CanonicalUnit===================================================== * base a canonical unit term;

func NewCanonicalUnit

func NewCanonicalUnit(base *BaseUnit, exponent int) (*CanonicalUnit, error)

type CelsiusHandler

type CelsiusHandler struct {
}

func (*CelsiusHandler) GetCode

func (c *CelsiusHandler) GetCode() string

func (*CelsiusHandler) GetUnits

func (c *CelsiusHandler) GetUnits() string

func (*CelsiusHandler) GetValue

func (c *CelsiusHandler) GetValue() decimal.Decimal

type Component

type Component struct {
}

type Componenter

type Componenter interface {
}

Component=====================================================

type Concept

type Concept struct {
	Code        string
	CodeUC      string
	Kind        ConceptKind
	Names       []string
	PrintSymbol string
}

func NewConcept

func NewConcept(kind ConceptKind, code string, codeUC string) (*Concept, error)

func (Concept) GetCode

func (c Concept) GetCode() string

func (Concept) GetCodeUC

func (c Concept) GetCodeUC() string

func (Concept) GetDescription

func (c Concept) GetDescription() string

func (Concept) GetKind

func (c Concept) GetKind() ConceptKind

func (Concept) GetNames

func (c Concept) GetNames() []string

func (Concept) GetPrintSymbol

func (c Concept) GetPrintSymbol() string

func (Concept) String

func (c Concept) String() string

type ConceptKind

type ConceptKind int
const (
	PREFIX ConceptKind = iota
	BASEUNIT
	UNIT
)

func ConceptKindString

func ConceptKindString(s string) (ConceptKind, error)

ConceptKindString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ConceptKindValues

func ConceptKindValues() []ConceptKind

ConceptKindValues returns all values of the enum

func (ConceptKind) IsAConceptKind

func (i ConceptKind) IsAConceptKind() bool

IsAConceptKind returns "true" if the value is listed in the enum definition. "false" otherwise

func (ConceptKind) String

func (i ConceptKind) String() string

type Concepter

type Concepter interface {
	GetDescription() string
	String() string
	GetCode() string
	GetKind() ConceptKind
	GetNames() []string
	GetCodeUC() string
	GetPrintSymbol() string
}

Concept===================================================== * Hierarchy

Concepter -> Concept -> Prefix -> Unit -> DefinedUnit

												-> BaseUnit
   |

Uniter -> Unit -> DefinedUnit

-> BaseUnit

Base of Unit and Prefix. Top class Code = String (case sensitive c/s) CodeUC = String, case insensitive c/i) Kind = ConceptKind (PREFIX, BASEUNIT or UNIT) Name = full (official) name of the concept PrintSymbol

type Converter

type Converter struct {
	Model    *UcumModel
	Handlers *Registry
}

func NewConverter

func NewConverter(model *UcumModel, handlers *Registry) *Converter

func (*Converter) Convert

func (c *Converter) Convert(term *Term) (*Canonical, error)

type DefinedUnit

type DefinedUnit struct {
	Unit
	Class       string
	IsSpecial   bool
	IsArbitrary bool
	Metric      bool
	Value       *Value
}

func NewDefinedUnit

func NewDefinedUnit(code string, codeUC string) (*DefinedUnit, error)

func (DefinedUnit) GetDescription

func (d DefinedUnit) GetDescription() string

type DefinedUnitFilter

type DefinedUnitFilter struct {
	DefinedUnits []*DefinedUnit
}

DefinedUnit===================================================== * Parent is Unit - Class "dimless" = dimensionless - Class SI "si" = the SI units (International System of Units)/ SI units are mole, steradian, hertz, newton, pascal, joule, watt, ampère, volt, farad, ohm, siemens, weber, degree, tesla, henry, lumen, lux, becquerel, gray, sievert - Class ISO1000 "iso1000" = other units from ISO 1000 - Class "const" = Natural units, velocity of light, Planck constant, etc. - Class "cgs" = The units of the older Centimeter-Gram-Second (CGS) system - Class "cust" = Customary units have once been used all over Europe. Units were taken from nature: anatomical structures (e.g., arm, foot, finger), botanical objects - Class "us-lengths" = The older U.S. units according to the definition of the inch in the U.S. Metric Law of 1866 and the definition of foot and yard that was valid from 1893 until 1959 - Class "us-volumes" = “capacity” measures, which are different for fluid goods (wine) and dry goods (grain) - Class "brit-volumes" = British Imperial volumes according to the Weights and Measures Act of 1824 - Class "avoirdupois" = The avoirdupois system is used in the U.S. as well as in coutries that use the British Imperial system. Avoirdupois is the default system of mass units used for all goods that “have weight” - Class "troy" = The troy system originates in Troyes, a City in the Champagne (France) that hosted a major European fair. - Class "apoth" = The apothecaries' system of mass units - Class "typeset" = There are three systems of typesetter's lengths in use today: Françcois-Ambroise Didot (1730-1804), Didot, U.S. type foundries - Class "heat" = Older units of heat (energy) and temperature - Class "clinical" = Units used mainly in clinical medicine - Class "chemical" = Units used mainly in chemical and biochemical laboratories - Class "levels" = Pseudo-units defined to express logarithms of ratios between two quantities of the same kind - Class "misc" = Not otherwise classified units - Class "infotech" = Units used in information technology

func NewDefinedUnitFilter

func NewDefinedUnitFilter(definedUnits []*DefinedUnit) *DefinedUnitFilter

func (*DefinedUnitFilter) FilterByClass

func (duf *DefinedUnitFilter) FilterByClass(class string) *DefinedUnitFilter

func (*DefinedUnitFilter) FilterByIsArbitrary

func (duf *DefinedUnitFilter) FilterByIsArbitrary(isArbitrary bool) *DefinedUnitFilter

func (*DefinedUnitFilter) FilterByIsMetric

func (duf *DefinedUnitFilter) FilterByIsMetric(isMetric bool) *DefinedUnitFilter

func (*DefinedUnitFilter) FilterByIsSpecial

func (duf *DefinedUnitFilter) FilterByIsSpecial(isSpecial bool) *DefinedUnitFilter

func (*DefinedUnitFilter) FilterByProperty

func (duf *DefinedUnitFilter) FilterByProperty(property string) *DefinedUnitFilter

type DefinitionParser

type DefinitionParser struct {
}

func (*DefinitionParser) UnmarshalTerminology

func (d *DefinitionParser) UnmarshalTerminology(reader io.Reader) (*UcumModel, error)

type ExpressionComposer

type ExpressionComposer struct {
}

type ExpressionParser

type ExpressionParser struct {
	Model *UcumModel
}

func NewExpressionParser

func NewExpressionParser(model *UcumModel) *ExpressionParser

func (*ExpressionParser) Parse

func (p *ExpressionParser) Parse(code string) (*Term, error)

type Factor

type Factor struct {
	Component
	Value int
}

Factor===================================================== * Parent is component Connected with TokenType NUMBER

func NewFactor

func NewFactor(value int) *Factor

type FahrenheitHandler

type FahrenheitHandler struct {
}

func (*FahrenheitHandler) GetCode

func (c *FahrenheitHandler) GetCode() string

func (*FahrenheitHandler) GetUnits

func (c *FahrenheitHandler) GetUnits() string

func (*FahrenheitHandler) GetValue

func (c *FahrenheitHandler) GetValue() decimal.Decimal

type FormalStructureComposer

type FormalStructureComposer struct {
}

type HoldingHandler

type HoldingHandler struct {
	Code  string
	Units string
	Value decimal.Decimal
}

func NewHoldingHandler

func NewHoldingHandler(code, units string, value decimal.Decimal) *HoldingHandler

func (*HoldingHandler) GetCode

func (c *HoldingHandler) GetCode() string

func (*HoldingHandler) GetUnits

func (c *HoldingHandler) GetUnits() string

func (*HoldingHandler) GetValue

func (c *HoldingHandler) GetValue() decimal.Decimal

type Lexer

type Lexer struct {
	Source    string
	Index     int
	Token     string
	TokenType TokenType
	Start     int
}

func NewLexer

func NewLexer(source string) *Lexer

func (*Lexer) Consume

func (l *Lexer) Consume() error

func (*Lexer) Finished

func (l *Lexer) Finished() bool

func (*Lexer) TokenAsInt

func (l *Lexer) TokenAsInt() (int, error)

type Operator

type Operator int
const (
	MULTIPLICATION Operator
	DIVISION
)

func OperatorString

func OperatorString(s string) (Operator, error)

func (Operator) String

func (i Operator) String() string

type Pair

type Pair struct {
	Value decimal.Decimal
	Code  string
}

Pair=====================================================

func NewPair

func NewPair(value decimal.Decimal, code string) *Pair

type Prefix

type Prefix struct {
	Concept
	Value decimal.Decimal
}

Prefix===================================================== * Parent is Concept Value = is the scalar value by which the unit atom is multiplied if combined with the prefix.

func NewPrefix

func NewPrefix(code string, codeUC string) (*Prefix, error)

func (Prefix) GetDescription

func (p Prefix) GetDescription() string

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Exists

func (r *Registry) Exists(code string) bool

func (*Registry) Get

func (r *Registry) Get(code string) SpecialUnitHandlerer

type SpecialUnitHandlerer

type SpecialUnitHandlerer interface {
	GetCode() string
	GetUnits() string
	GetValue() decimal.Decimal
}

type Symbol

type Symbol struct {
	Component
	Unit     Uniter
	Prefix   *Prefix
	Exponent int
}

Symbol===================================================== * // Unit may be Base Unit or DefinedUnit // Prefix only if unit is metric

func NewSymbol

func NewSymbol(unit Uniter, prefix *Prefix, exponent int) (*Symbol, error)

func (*Symbol) HasPrefix

func (s *Symbol) HasPrefix() bool

func (*Symbol) InvertExponent

func (s *Symbol) InvertExponent()

type Term

type Term struct {
	Component
	Comp Componenter
	Op   Operator
	Term *Term
}

Term===================================================== op-term where op = / component component-op-term * Parent is Component

func NewTerm

func NewTerm() (*Term, error)

func (*Term) SetTermCheckOp

func (t *Term) SetTermCheckOp(term *Term)

type TokenType

type TokenType int
const (
	NONE TokenType
	NUMBER
	SYMBOL
	SOLIDUS
	PERIOD
	OPEN
	CLOSE
	ANNOTATION
)

func TokenTypeString

func TokenTypeString(s string) (TokenType, error)

func (TokenType) String

func (i TokenType) String() string

type UcumClassInfo

type UcumClassInfo struct {
	Name        string
	Description string
}

type UcumEssenceService

type UcumEssenceService struct {
	Model    *UcumModel
	Handlers *Registry
}

func GetInstanceOfUcumEssenceService

func GetInstanceOfUcumEssenceService(xmlFileName string) (*UcumEssenceService, error)

func (*UcumEssenceService) Analyse

func (u *UcumEssenceService) Analyse(unit string) (string, error)

func (*UcumEssenceService) Convert

func (u *UcumEssenceService) Convert(value decimal.Decimal, sourceUnit, destUnit string) (decimal.Decimal, error)

func (*UcumEssenceService) FilterDefinedModels

func (u *UcumEssenceService) FilterDefinedModels(class string, property string, onIsMetric, isMetric bool, onIsSpecial, isSpecial bool, onIsArbitrary, isArbitrary bool) []*DefinedUnit

func (*UcumEssenceService) GetCanonicalForm

func (u *UcumEssenceService) GetCanonicalForm(value *Pair) (*Pair, error)

func (*UcumEssenceService) GetCanonicalUnits

func (u *UcumEssenceService) GetCanonicalUnits(unit string) (string, error)

func (*UcumEssenceService) GetClassInfo

func (u *UcumEssenceService) GetClassInfo(class string) *UcumClassInfo

func (*UcumEssenceService) GetCommonDisplay

func (u *UcumEssenceService) GetCommonDisplay(code string) string

func (*UcumEssenceService) GetDefinedForms

func (u *UcumEssenceService) GetDefinedForms(code string) ([]*DefinedUnit, error)

func (*UcumEssenceService) GetProperties

func (u *UcumEssenceService) GetProperties() []string

func (*UcumEssenceService) IsComparable

func (u *UcumEssenceService) IsComparable(units1, units2 string) (bool, error)

func (*UcumEssenceService) ListAllClasses

func (u *UcumEssenceService) ListAllClasses() []string

func (*UcumEssenceService) ListAllProperties

func (u *UcumEssenceService) ListAllProperties() []string

func (*UcumEssenceService) Multiply

func (u *UcumEssenceService) Multiply(o1, o2 *Pair) (*Pair, error)

func (*UcumEssenceService) Search

func (u *UcumEssenceService) Search(kind ConceptKind, text string, isRegex bool) ([]Concepter, error)

func (*UcumEssenceService) SearchClass

func (u *UcumEssenceService) SearchClass(arg string) []string

func (*UcumEssenceService) SearchProperty

func (u *UcumEssenceService) SearchProperty(arg string) []string

func (*UcumEssenceService) UcumIdentification

func (u *UcumEssenceService) UcumIdentification() *UcumVersionDetails

func (*UcumEssenceService) Validate

func (u *UcumEssenceService) Validate(unit string) (bool, string)

func (*UcumEssenceService) ValidateCanonicalUnits

func (u *UcumEssenceService) ValidateCanonicalUnits(unit, canonical string) string

func (*UcumEssenceService) ValidateInProperty

func (u *UcumEssenceService) ValidateInProperty(unit, property string) string

func (*UcumEssenceService) ValidateUCUM

func (u *UcumEssenceService) ValidateUCUM() []string

type UcumModel

type UcumModel struct {
	Version              string
	Revision             string
	RevisionDate         time.Time
	Prefixes             []*Prefix
	BaseUnits            []*BaseUnit
	DefinedUnits         []*DefinedUnit
	UcumClassInfoMap     map[string]*UcumClassInfo
	BaseUnitsByCode      map[string]*BaseUnit
	BaseUnitsByCodeUC    map[string]*BaseUnit
	DefinedUnitsByCode   map[string]*DefinedUnit
	DefinedUnitsByCodeUC map[string]*DefinedUnit
	PropertySearchIndex  map[string][]string
	PropertyList         []string
	ClassSearchIndex     map[string][]string
	ClassList            []string
}

func NewUcumModel

func NewUcumModel(version, revision string, revisionDate time.Time) *UcumModel

func (*UcumModel) GetUnit

func (u *UcumModel) GetUnit(code string) Uniter

func (*UcumModel) Search

func (u *UcumModel) Search(kind ConceptKind, text string, isRegex bool) []Concepter

type UcumService

type UcumService interface {
	/**
	 * return Ucum Identification details for the version in use
	 */
	UcumIdentification() *UcumVersionDetails
	/**
	 * Check UCUM. Note that this stands as a test of the service
	 * more than UCUM itself (for version 1.7, there are no known
	 * semantic errors in UCUM). But you should always run this test at least
	 * once with the version of UCUM you are using to ensure that
	 * the service implementation correctly understands the UCUM data
	 * to which it is bound
	 *
	 * @return a list of internal errors in the UCUM spec.
	 *
	 */
	ValidateUCUM() []string
	/**
	 * Search through the UCUM concepts for any concept containing matching text.
	 * Search will be limited to the kind of concept defined by kind, or all if kind
	 * is null
	 *
	 * @param kind - can be null. scope of search
	 * @param text - required
	 * @param isRegex
	 * @return
	 */
	Search(kind ConceptKind, text string, isRegex bool) ([]Concepter, error)
	/**
	 * return a list of the defined types of units in this UCUM version
	 *
	 * @return
	 */
	GetProperties() []string
	/**
	 * validate whether a unit code are valid UCUM units
	 *
	 * @param units - the unit code to check
	 * @return nil if valid, or an error message describing the problem
	 */
	Validate(unit string) (bool, string)
	/**
	 * given a unit, return a formal description of what the units stand for using
	 * full names
	 * @param units the unit code
	 * @return formal description
	 * @throws UcumException
	 * @throws OHFException
	 */
	Analyse(unit string) (string, error)
	/**
	 * validate whether a units are valid UCUM units and additionally require that the
	 * units from a particular property
	 *
	 * @param units - the unit code to check
	 * @return nil if valid, or an error message describing the problem
	 */
	ValidateInProperty(unit, property string) string
	/**
	 * validate whether a units are valid UCUM units and additionally require that the
	 * units match a particular base canonical unit
	 *
	 * @param units - the unit code to check
	 * @return nil if valid, or an error message describing the problem
	 */
	ValidateCanonicalUnits(unit, canonical string) string
	/**
	 * given a set of units, return their canonical form
	 * @param unit
	 * @return the canonical form
	 * @throws UcumException
	 * @throws OHFException
	 */
	GetCanonicalUnits(unit string) (string, error)
	/**
	 * given two pairs of units, return true if they share the same canonical base
	 *
	 * @param units1
	 * @param units2
	 * @return
	 * @throws UcumException
	 * @
	 */
	IsComparable(units1, units2 string) (bool, error)
	/**
	 * for a given canonical unit, return all the defined units that have the
	 * same canonical unit.
	 *
	 * @param code
	 * @return
	 * @throws UcumException
	 * @throws OHFException
	 */
	GetDefinedForms(code string) ([]*DefinedUnit, error)
	/**
	 * given a value/unit pair, return the canonical form as a value/unit pair
	 *
	 * 1 mm -> 1e-3 m
	 * @param value
	 * @return
	 * @throws UcumException
	 * @throws OHFException
	 */
	GetCanonicalForm(value *Pair) (*Pair, error)
	/**
	 * given a value and source unit, return the value in the given dest unit
	 * an exception is thrown if the conversion is not possible
	 *
	 * @param value
	 * @param sourceUnit
	 * @param destUnit
	 * @return the value if a conversion is possible
	 * @throws UcumException
	 * @throws OHFException
	 */
	Convert(value decimal.Decimal, sourceUnit, destUnit string) (decimal.Decimal, error)
	/**
	 * multiply two value/units pairs together and return the result in canonical units
	 *
	 * Note: since the units returned are canonical,
	 * @param o1
	 * @param o2
	 * @return
	 * @throws UcumException
	 * @
	 */
	Multiply(o1, o2 *Pair) (*Pair, error)
	/**
	 * given a set of UCUM units, return a likely preferred human dense form
	 *
	 * SI units - as is.
	 * Other units - improved by manual fixes, or the removal of []
	 *
	 * @param code
	 * @return the preferred human display form
	 */
	GetCommonDisplay(code string) string

	ListAllClasses() []string
	ListAllProperties() []string
	SearchClass(arg string) []string
	SearchProperty(arg string) []string
	GetClassInfo(class string) *UcumClassInfo
	FilterDefinedModels(class string, property string, onIsMetric, isMetric bool, onIsSpecial, isSpecial bool, onIsArbitrary, isArbitrary bool) []*DefinedUnit
}

type UcumValidator

type UcumValidator struct {
	Model    *UcumModel
	Result   []string
	Handlers *Registry
}

UcumEssenceService=======================================================

func NewUcumValidator

func NewUcumValidator(model *UcumModel, handlers *Registry) *UcumValidator

func (*UcumValidator) Validate

func (v *UcumValidator) Validate() []string

type UcumVersionDetails

type UcumVersionDetails struct {
	ReleaseDate time.Time
	Version     string
}

UcumVersionDetails======================================================

func NewUcumVersionDetails

func NewUcumVersionDetails(releaseDate time.Time, version string) *UcumVersionDetails

type Unit

type Unit struct {
	Concept
	Property string
}

func NewUnit

func NewUnit(kind ConceptKind, code string, codeUC string) (*Unit, error)

func (Unit) GetDescription

func (u Unit) GetDescription() string

func (Unit) GetProperty

func (u Unit) GetProperty() string

func (*Unit) SetProperty

func (u *Unit) SetProperty(property string)

func (Unit) String

func (u Unit) String() string

type Uniter

type Uniter interface {
	Concepter
	GetProperty() string
}

Unit===================================================== * Parent is Concept Children are BaseUnit and DefinedUnit

type Value

type Value struct {
	Text   string
	Unit   string
	UnitUC string
	Value  decimal.Decimal
}

Value=====================================================

func NewValue

func NewValue(unit, unitUC string, value decimal.Decimal) (*Value, error)

func (Value) GetDescription

func (v Value) GetDescription() string

type XMLBaseUnit

type XMLBaseUnit struct {
	XMLUnit
	Dim rune `xml:"dim"`
}

type XMLConcept

type XMLConcept struct {
	Code        string `xml:"Code,attr"`
	CodeUC      string `xml:"CODE,attr"`
	Name        string `xml:"name"`
	PrintSymbol string `xml:"printSymbol"`
}

type XMLDecimal

type XMLDecimal struct {
	Decimal    int
	Digits     string
	Negative   bool
	Precision  int
	Scientific bool
}

type XMLDefinedUnit

type XMLDefinedUnit struct {
	XMLUnit
	Class       string   `xml:"class,attr"`
	IsSpecial   string   `xml:"isSpecial,attr"`
	IsArbitrary string   `xml:"isArbitrary,attr"`
	Metric      string   `xml:"isMetric,attr"`
	Value       XMLValue `xml:"value"`
}

type XMLPrefix

type XMLPrefix struct {
	XMLConcept
	Value XMLValue `xml:"value"` //"1e2" //precision 24
}

type XMLRoot

type XMLRoot struct {
	Version        string             `xml:"version,attr"`
	Revision       string             `xml:"revision,attr"`
	RevisionDate   string             `xml:"revision-date,attr"`
	Prefixes       []XMLPrefix        `xml:"prefix"`
	BaseUnits      []XMLBaseUnit      `xml:"base-unit"`
	DefinedUnits   []XMLDefinedUnit   `xml:"unit"`
	UcumClassInfos []XMLUcumClassInfo `xml:"ucum-class"`
}

func (*XMLRoot) ProcessRevisionDate

func (x *XMLRoot) ProcessRevisionDate(revisionDate string) (time.Time, error)

func (*XMLRoot) UcumModel

func (x *XMLRoot) UcumModel() (*UcumModel, error)

type XMLUcumClassInfo

type XMLUcumClassInfo struct {
	Name        string `xml:"name"`
	Description string `xml:"description"`
}

type XMLUnit

type XMLUnit struct {
	XMLConcept
	Property string `xml:"property"`
}

type XMLValue

type XMLValue struct {
	Unit   string `xml:"Unit,attr"`
	UnitUC string `xml:"UNIT,attr"`
	Value  string `xml:"value,attr"`
}

Directories

Path Synopsis
convey

Jump to

Keyboard shortcuts

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