Documentation ¶
Index ¶
- func PriceString(price *big.Rat, currency string) string
- type Basket
- type List
- type Object
- type Usage
- func (u *Usage) BillableQuantity() *big.Rat
- func (u *Usage) LostQuantity() *big.Rat
- func (u *Usage) SetDuration(duration time.Duration) error
- func (u *Usage) SetQuantity(quantity *big.Rat) error
- func (u *Usage) SetStartEnd(start, end time.Time) error
- func (u *Usage) Total() *big.Rat
- func (u *Usage) TotalString() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Basket ¶
type Basket []Usage
Basket represents a billing basket
func (*Basket) SetDuration ¶
SetDuration sets the duration for each Usages of a Basket
type List ¶ added in v1.7.0
type List []Object
List represents a list of Object
var CurrentPricing List
CurrentPricing tries to be up-to-date with the real pricing we cannot guarantee of these values since we hardcode values for now later, we should be able to call a dedicated pricing API
func (*List) GetByIdentifier ¶ added in v1.7.0
GetByIdentifier returns an object matching a identifier
type Object ¶ added in v1.7.0
type Object struct { Path string Identifier string Currency string UsageUnit string UnitPrice *big.Rat UnitQuantity *big.Rat UnitPriceCap *big.Rat UsageGranularity time.Duration }
Object represents a Pricing item definition
type Usage ¶
Usage represents a billing usage
func NewUsageByPath ¶
NewUsageByPath returns a new Usage with defaults fetched from a path
func NewUsageByPathWithQuantity ¶
NewUsageByPathWithQuantity returns a NewUsageByPath with a specific quantity
func NewUsageWithQuantity ¶
NewUsageWithQuantity returns a new Usage with quantity
func (*Usage) BillableQuantity ¶
BillableQuantity returns the billable quantity of an Usage
func (*Usage) LostQuantity ¶
LostQuantity returns the lost quantity of an Usage
func (*Usage) SetDuration ¶
SetDuration sets the duration of an Usage
func (*Usage) SetQuantity ¶
SetQuantity sets the quantity of an Usage
func (*Usage) SetStartEnd ¶
SetStartEnd sets the start date and the end date of an Usage
func (*Usage) TotalString ¶
TotalString returns a string representing the total price of an Usage + its currency