Documentation ¶
Index ¶
- type BaseQuantity
- type CWT
- type Cents
- func (c Cents) AddCents(a Cents) Cents
- func (c Cents) Float64() float64
- func (c Cents) Int() int
- func (c Cents) Int64() int64
- func (c Cents) Multiply(i int) Cents
- func (c Cents) MultiplyFloat64(f float64) Cents
- func (c Cents) MultiplyMiles(d Miles) Cents
- func (c Cents) String() string
- func (c Cents) ToDollarFloatNoRound() float64
- func (c Cents) ToDollarString() string
- func (c Cents) ToMillicents() Millicents
- type CubicFeet
- type CubicThousandthInch
- type DiscountRate
- type Dollars
- type Miles
- type Millicents
- func (m Millicents) Float64() float64
- func (m Millicents) Int() int
- func (m Millicents) Int64() int64
- func (m Millicents) MultiplyFloat64(f float64) Millicents
- func (m Millicents) ToCents() Cents
- func (m Millicents) ToDollarFloat() float64
- func (m Millicents) ToDollarFloatNoRound() float64
- func (m Millicents) ToDollarString() string
- type Pound
- type ThousandthInches
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 Cents ¶
type Cents int
Cents represents a value in hundreths of US dollars (aka cents).
func (Cents) MultiplyFloat64 ¶
MultiplyFloat64 returns the value of self multiplied by multiplier
func (Cents) MultiplyMiles ¶
MultiplyMiles returns the value of self multiplied by multiplier
func (Cents) ToDollarFloatNoRound ¶
ToDollarFloatNoRound returns a dollar float representation of this value
func (Cents) ToDollarString ¶
ToDollarString returns a dollar string representation of this value
func (Cents) ToMillicents ¶
func (c Cents) ToMillicents() Millicents
ToMillicents converts cents to millicents
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
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) 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) ToCWTFloat64 ¶
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