dimparser

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Millimeter Length = 1
	Centimeter        = Millimeter * 10
	// Meter represents millimeter(m)
	Meter = Centimeter * 100
	// KiloMeter represents millimeter(km)
	KiloMeter = Meter * 1000
)

common lengths

Variables

This section is empty.

Functions

This section is empty.

Types

type Dimensions added in v0.2.1

type Dimensions struct {
	Width  Length
	Depth  Length
	Height Length
}

Dimensions represents the object's width x depth x height

func Parse

func Parse(s string) *Dimensions

Parse returns parsed dimensions When none of the lengths are parsed, it returns nil

type Length

type Length int64

Length represents the length of a thing

func (Length) Centimeters

func (l Length) Centimeters() float64

Centimeters returns the length as a centimeter(cm)

func (Length) Kilometers

func (l Length) Kilometers() float64

Kilometers returns the length as a kilometers(km)

func (Length) Meters

func (l Length) Meters() float64

Meters returns the length as a millimeter(m)

func (Length) Millimeters

func (l Length) Millimeters() int64

Millimeters returns the length as a millimeter(mm)

Jump to

Keyboard shortcuts

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