unit

package
v0.0.0-...-c407d37 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseQuantity

type BaseQuantity int

BaseQuantity represents a value in the 10,000ths of a unit measurement for shipment line items. Eg. 10000 BQ = 1.0000 unit or 1 BQ = .0001 A unit of measurement can be below or more: BW = Net Billing Weight CF = Cubic Foot EA = Each FR = Flat Rate FP = Fuel Percentage NR = Container MV = Monetary Value TD = Days TH = Hours

func BaseQuantityFromCents

func BaseQuantityFromCents(c Cents) BaseQuantity

BaseQuantityFromCents creates a BaseQuantity for a provided Cents

func BaseQuantityFromFloat

func BaseQuantityFromFloat(i float32) BaseQuantity

BaseQuantityFromFloat a BaseQuantity for a provided float32

func BaseQuantityFromInt

func BaseQuantityFromInt(i int) BaseQuantity

BaseQuantityFromInt creates a BaseQuantity for a provided int

func BaseQuantityFromThousandthInches

func BaseQuantityFromThousandthInches(ti ThousandthInches) BaseQuantity

BaseQuantityFromThousandthInches creates a BaseQuantity for a provided ThousandthInches

func IntToBaseQuantity

func IntToBaseQuantity(quantity *int64) *BaseQuantity

IntToBaseQuantity returns a unit in BaseQuantity format

func (BaseQuantity) String

func (bq BaseQuantity) String() string

String returns the value of self as string

func (BaseQuantity) ToUnitDollarString

func (bq BaseQuantity) ToUnitDollarString() string

ToUnitDollarString returns a dollar string representation of this value

func (BaseQuantity) ToUnitFloat

func (bq BaseQuantity) ToUnitFloat() float64

ToUnitFloat returns a unit float representation of this value Eg. 10000 BQ -> 1.0000

func (BaseQuantity) ToUnitFloatString

func (bq BaseQuantity) ToUnitFloatString() string

ToUnitFloatString returns a unit string representation of this value Eg. 10000 BQ -> "1.0000"

func (BaseQuantity) ToUnitInt

func (bq BaseQuantity) ToUnitInt() int

ToUnitInt returns a unit int representation of this value Eg. 10000 BQ -> 1

type CWT

type CWT int

CWT represents a value that is a multiple of 100 pounds

func (CWT) Int

func (cwt CWT) Int() int

Int returns an integer representation of this weight

func (CWT) String

func (cwt CWT) String() string

String gives a string representation of CWT

func (CWT) ToPounds

func (cwt CWT) ToPounds() Pound

ToPounds returns the weight of this CWT in pounds

type Cents

type Cents int

Cents represents a value in hundreths of US dollars (aka cents).

func (Cents) AddCents

func (c Cents) AddCents(a Cents) Cents

AddCents returns the value of self added with the parameter

func (Cents) Float64

func (c Cents) Float64() float64

Float64 returns the value of self as a float64

func (Cents) Int

func (c Cents) Int() int

Int returns the value of self as an int

func (Cents) Int64

func (c Cents) Int64() int64

Int64 returns the value of self as an int

func (Cents) Multiply

func (c Cents) Multiply(i int) Cents

Multiply returns the value of self multiplied by multiplier

func (Cents) MultiplyFloat64

func (c Cents) MultiplyFloat64(f float64) Cents

MultiplyFloat64 returns the value of self multiplied by multiplier

func (Cents) MultiplyMiles

func (c Cents) MultiplyMiles(d Miles) Cents

MultiplyMiles returns the value of self multiplied by multiplier

func (Cents) String

func (c Cents) String() string

func (Cents) ToDollarFloatNoRound

func (c Cents) ToDollarFloatNoRound() float64

ToDollarFloatNoRound returns a dollar float representation of this value

func (Cents) ToDollarString

func (c Cents) ToDollarString() string

ToDollarString returns a dollar string representation of this value

func (Cents) ToMillicents

func (c Cents) ToMillicents() Millicents

ToMillicents converts cents to millicents

type CubicFeet

type CubicFeet float64

CubicFeet represents cubic feet

func (CubicFeet) String

func (c CubicFeet) String() string

String converts a CubicFeet value into a string

type CubicThousandthInch

type CubicThousandthInch int

CubicThousandthInch represents values in cubic thousandths of an inch

func (CubicThousandthInch) ToCubicFeet

func (cti CubicThousandthInch) ToCubicFeet() CubicFeet

ToCubicFeet converts cubic thousandths of an inch to cubic feet

type DiscountRate

type DiscountRate float64

DiscountRate represents a percentage, usually represented as a value between 0% and 100%.

func NewDiscountRateFromPercent

func NewDiscountRateFromPercent(input float64) DiscountRate

NewDiscountRateFromPercent createDecimals a new DiscountRate using a float64 with 100 representing one whole unit.

func (DiscountRate) Apply

func (r DiscountRate) Apply(c Cents) Cents

Apply returns the remaining charge after applying a DiscountRate.

Note: The value returned is calculated by first determining the Percent of Tariff by subtracting the discount rate from 1 and then multiplying the result by the Cents parameter.

func (DiscountRate) ApplyToMillicents

func (r DiscountRate) ApplyToMillicents(c Millicents) Millicents

ApplyToMillicents returns the rate with discount applied for Millicent values Note: In order to maintain cent level accuracy for rates that are provided in the tariff 400ng as cents, c must be the millicent rate/ 1000, then multiplied by 1000 after discount is applied.

func (DiscountRate) Float64

func (r DiscountRate) Float64() float64

Float64 returns the Rate's value as a float64 with 1 representing one whole unit.

type Dollars

type Dollars float64

Dollars represents dollar value in float64

func (Dollars) ToMillicents

func (d Dollars) ToMillicents() Millicents

ToMillicents converts dollars to millicents

type Miles

type Miles int

Miles represents mile value in int

func (Miles) Float64

func (miles Miles) Float64() float64

Float64 gives a float representation of Miles

func (Miles) Int

func (miles Miles) Int() int

Int gives an int representation of Miles

func (Miles) String

func (miles Miles) String() string

String gives a string representation of Miles

type Millicents

type Millicents int

Millicents represents hundredthousandths of US dollars (1000 millicents/ cent)

func (Millicents) Float64

func (m Millicents) Float64() float64

Float64 returns the value of self as a float64

func (Millicents) Int

func (m Millicents) Int() int

Int returns the value of self as an int

func (Millicents) Int64

func (m Millicents) Int64() int64

Int64 returns the value of self as an int64

func (Millicents) MultiplyFloat64

func (m Millicents) MultiplyFloat64(f float64) Millicents

MultiplyFloat64 returns the value of self multiplied by multiplier

func (Millicents) ToCents

func (m Millicents) ToCents() Cents

ToCents returns a Cents representation of this value

func (Millicents) ToDollarFloat

func (m Millicents) ToDollarFloat() float64

ToDollarFloat returns a dollar representation of this value (rounded to nearest 2 decimals)

func (Millicents) ToDollarFloatNoRound

func (m Millicents) ToDollarFloatNoRound() float64

ToDollarFloatNoRound returns a dollar representation of this value (no rounding, so partial cents possible)

func (Millicents) ToDollarString

func (m Millicents) ToDollarString() string

ToDollarString returns a dollar string representation of this value

type Pound

type Pound int

Pound represents a value that is a multiple of 1 pound

func (Pound) Float64

func (pounds Pound) Float64() float64

Float64 returns a float representation of this weight

func (Pound) Int

func (pounds Pound) Int() int

Int returns an integer representation of this weight

func (Pound) Int64

func (pounds Pound) Int64() int64

Int64 returns an integer representation of this weight

func (Pound) ToCWT

func (pounds Pound) ToCWT() CWT

ToCWT returns the weight of this in CWT, rounded to the nearest integer

func (Pound) ToCWTFloat64

func (pounds Pound) ToCWTFloat64() float64

ToCWTFloat64 returns a float64 representation of this weight (no rounding)

type ThousandthInches

type ThousandthInches int

ThousandthInches Inches represents a value in thousandth of an inch Eg. 1.00 inch = 1000 ThousandthInches

func (ThousandthInches) Int32Ptr

func (t ThousandthInches) Int32Ptr() *int32

Int32Ptr returns the int32 representation of an int type.

func (ThousandthInches) ToFeet

func (t ThousandthInches) ToFeet() float64

ToFeet returns feet for this value

func (ThousandthInches) ToInches

func (t ThousandthInches) ToInches() float64

ToInches returns inches for this value

Jump to

Keyboard shortcuts

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