tools

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDailyBilling

func AddDailyBilling(x, y data.DailyBilling) data.DailyBilling

func AddDate

func AddDate(t time.Time, years, months, days int) time.Time

AddDate

func AddMonthlyBilling

func AddMonthlyBilling(x, y data.MonthlyBilling) data.MonthlyBilling

func AddProductBilling

func AddProductBilling(x, y data.ProductBilling) (data.ProductBilling, error)

func CurrencyUnit

func CurrencyUnit(name string) (result string)

func Date2Month

func Date2Month(date string) string

Date2Month 2022-10-09 -> 2022-10

func Float64Add

func Float64Add(a ...float64) float64

func GetCurrentDirectory

func GetCurrentDirectory() (string, error)

GetCurrentDirectory

func IsValidDayDate

func IsValidDayDate(d string) bool

IsValidDayDate 2006-01-02 满足格式且真实存在的日期

func IsValidMonthDate

func IsValidMonthDate(d string) bool

IsValidMonthDate 2006-01 满足格式且真实存在的日期

func RatioString

func RatioString(s1, s2 string) string

func ShowHtml

func ShowHtml(fPath string) error

func SumByInstanceId added in v0.2.1

func SumByInstanceId(utilizations []data.InstanceCpuUtilization) int

func Union

func Union(s1, s2 []string) []string

Types

type BillingDate

type BillingDate struct {
	Months []string `json:"months"` //["2022-02"]
	Days   []string `json:"days"`   //["2022-03-01","2022-03-02", ..."2022-03-29"]
}

type BillingDatePilot

type BillingDatePilot struct {
	// contains filtered or unexported fields
}

func NewBillDatePilot

func NewBillDatePilot() *BillingDatePilot

func (*BillingDatePilot) ConvBillingDate2PreviousMonth

func (p *BillingDatePilot) ConvBillingDate2PreviousMonth(d BillingDate) BillingDate

ConvBillingDate2PreviousMonth

func (*BillingDatePilot) ConvBillingDate2PreviousQuarter

func (p *BillingDatePilot) ConvBillingDate2PreviousQuarter(d BillingDate) BillingDate

ConvDays2LastQuarter

func (*BillingDatePilot) GetBillingDate

func (p *BillingDatePilot) GetBillingDate(isRecentYear bool, firstMonths []int64) BillingDate

GetBillingDate isCurrentYear: true 今年 | false 去年

func (*BillingDatePilot) GetDaysInRecentMonth

func (p *BillingDatePilot) GetDaysInRecentMonth() []string

GetDaysInRecentMonth 获取截至今天的当前月份的日期 [2022-10-01, 2022-10-02, ..., 2022-10-07]

func (*BillingDatePilot) GetNowT

func (p *BillingDatePilot) GetNowT() time.Time

func (*BillingDatePilot) GetPreviousDayBillingDate

func (p *BillingDatePilot) GetPreviousDayBillingDate() BillingDate

GetPreviousDayBillingDate

func (*BillingDatePilot) GetPreviousMonth

func (p *BillingDatePilot) GetPreviousMonth() string

GetPreviousMonth

func (*BillingDatePilot) GetPreviousYear

func (p *BillingDatePilot) GetPreviousYear(curYear ...string) string

GetPreviousYear

func (*BillingDatePilot) GetPreviousYearBillingDate

func (p *BillingDatePilot) GetPreviousYearBillingDate() BillingDate

GetPreviousYearBillingDate

func (*BillingDatePilot) GetRecentDayBillingDate

func (p *BillingDatePilot) GetRecentDayBillingDate() BillingDate

GetRecentDayBillingDate

func (*BillingDatePilot) GetRecentMonth

func (p *BillingDatePilot) GetRecentMonth() string

GetRecentMonth

func (*BillingDatePilot) GetRecentMonthBillingDate

func (p *BillingDatePilot) GetRecentMonthBillingDate(isRecentYear bool) BillingDate

GetRecentMonthBillingDate

func (*BillingDatePilot) GetRecentQuarter

func (p *BillingDatePilot) GetRecentQuarter() int

GetRecentQuarter

func (*BillingDatePilot) GetRecentQuarterBillingDate

func (p *BillingDatePilot) GetRecentQuarterBillingDate(isRecentYear bool) BillingDate

GetRecentQuarterBillingDate

func (*BillingDatePilot) GetRecentXDaysBillingDate

func (p *BillingDatePilot) GetRecentXDaysBillingDate(x int32) BillingDate

GetRecentXDaysBillingDate 返回过去 X 天(不含今天)的日期 ["2022-09-24","2022-09-25", ... "2022-10-07"]

func (*BillingDatePilot) GetRecentXMonthsBillingDate

func (p *BillingDatePilot) GetRecentXMonthsBillingDate(x int32) BillingDate

GetRecentXMonthsBillingDate 返回过去 x 个月(不含 1 号当月) ["2021-11","2021-12", ... "2022-09",]

func (*BillingDatePilot) GetRecentYear

func (p *BillingDatePilot) GetRecentYear() int

GetRecentYear

func (*BillingDatePilot) GetRecentYearBillingDate

func (p *BillingDatePilot) GetRecentYearBillingDate() BillingDate

GetRecentYearBillingDate

func (*BillingDatePilot) GetRecentYearMonths

func (p *BillingDatePilot) GetRecentYearMonths() []string

GetYearMonths 获取今年截至今天的所有月份 [2022-01,2022-02, ..., 2022-10]

func (*BillingDatePilot) GetTargetYearData

func (p *BillingDatePilot) GetTargetYearData(data []string, offset int) []string

GetTargetYearData 获取目标年的年/月/日数据 offset : negative value for the year before ,vice versa

func (*BillingDatePilot) IsFirstDayOfYear

func (p *BillingDatePilot) IsFirstDayOfYear() bool

IsFirstDayOfYear

func (*BillingDatePilot) SetNowT

func (p *BillingDatePilot) SetNowT(t time.Time) *BillingDatePilot

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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