billing

package
v0.3.10-0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BillingCycleMinute = TBillingCycleUnit("I")
	BillingCycleHour   = TBillingCycleUnit("H")
	BillingCycleDay    = TBillingCycleUnit("D")
	BillingCycleWeek   = TBillingCycleUnit("W")
	BillingCycleMonth  = TBillingCycleUnit("M")
	BillingCycleYear   = TBillingCycleUnit("Y")
)

Variables

View Source
var (
	ErrInvalidBillingCycle = errors.New("invalid billing cycle")
	ErrInvalidDuration     = errors.New("invalid duration")
)

Functions

This section is empty.

Types

type SBillingCycle

type SBillingCycle struct {
	AutoRenew bool
	Count     int
	Unit      TBillingCycleUnit
}

func DurationToBillingCycle

func DurationToBillingCycle(dur time.Duration) SBillingCycle

parse duration to minute unit billing cycle

func ParseBillingCycle

func ParseBillingCycle(cycleStr string) (SBillingCycle, error)

func (SBillingCycle) Duration

func (cycle SBillingCycle) Duration() time.Duration

func (SBillingCycle) EndAt

func (cycle SBillingCycle) EndAt(tm time.Time) time.Time

func (*SBillingCycle) GetDays

func (cycle *SBillingCycle) GetDays() int

func (*SBillingCycle) GetMonths

func (cycle *SBillingCycle) GetMonths() int

func (*SBillingCycle) GetWeeks

func (cycle *SBillingCycle) GetWeeks() int

func (*SBillingCycle) GetYears

func (cycle *SBillingCycle) GetYears() int

func (*SBillingCycle) IsValid

func (cycle *SBillingCycle) IsValid() bool

func (SBillingCycle) LatestLastStart

func (cycle SBillingCycle) LatestLastStart(tm time.Time) time.Time

func (*SBillingCycle) String

func (cycle *SBillingCycle) String() string

func (SBillingCycle) TimeString

func (cycle SBillingCycle) TimeString(tm time.Time) string

type TBillingCycleUnit

type TBillingCycleUnit string

Jump to

Keyboard shortcuts

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