Documentation ¶
Index ¶
- Constants
- Variables
- type SBillingCycle
- func (cycle SBillingCycle) Duration() time.Duration
- func (cycle SBillingCycle) EndAt(tm time.Time) time.Time
- func (cycle *SBillingCycle) GetDays() int
- func (cycle *SBillingCycle) GetMonths() int
- func (cycle *SBillingCycle) GetWeeks() int
- func (cycle *SBillingCycle) GetYears() int
- func (cycle *SBillingCycle) IsValid() bool
- func (cycle SBillingCycle) LatestLastStart(tm time.Time) time.Time
- func (cycle *SBillingCycle) String() string
- func (cycle SBillingCycle) TimeString(tm time.Time) string
- type TBillingCycleUnit
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) 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
Click to show internal directories.
Click to hide internal directories.