Documentation
¶
Index ¶
Constants ¶
View Source
const ( YearDays = 360 MonthDays = 30 YearMonth = 12 )
define days
View Source
const ( RateTypeDay = iota + 1 RateTypeMonth RateTypeYear )
日、月、年利率
View Source
const ( // 普通算法 CalcTypeDaily = iota + 1 // 等额本息 CalcTypeAverageCapitalPlus // 等额本金 CalcTypeAverageCapital )
利息算法
Variables ¶
View Source
var ( ErrInvalidInputParams = errors.New("invalid input params") ErrNotSupportedRateType = errors.New("rate type not supported") ErrNotSupportedCalcType = errors.New("calculate type not supported") )
define errors
Functions ¶
This section is empty.
Types ¶
type Interest ¶
type Interest interface { CalcPayback(*InterestSets) (*Payback, error) CalcAllPaybackAmount(*InterestSets) (int64, error) CalcAllInterests(*InterestSets) (int64, error) }
Interest 利息计算公式
type InterestSets ¶
type InterestSets struct { // 利率类型 RateType int `valid:"gt=0,lt=4"` // 利率 InterestRate float64 `valid:"gte=0.0"` // 还款次数,日还款写天数,等额本息和等额本金为月数 PayTimes int `valid:"gte=0"` // 借款金额 Amount int64 `valid:"gte=0"` // 借款开始日 StartDate string // contains filtered or unexported fields }
InterestSets 利息计算配置
Click to show internal directories.
Click to hide internal directories.