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.TN(namespace, 1000, "invalid input params: {{.err}}") ErrNotSupportedRateType = errors.TN(namespace, 1001, "rate type not supported: {{.rate_type}}") ErrNotSupportedCalcType = errors.TN(namespace, 1002, "calculate type not supported: {{.cal_type}}") )
define errors
Functions ¶
This section is empty.
Types ¶
type Interest ¶
type Interest interface { CalcPayback(*InterestSets) (*Payback, errors.ErrorCode) CalcAllPaybackAmount(*InterestSets) (int64, errors.ErrorCode) CalcAllInterests(*InterestSets) (int64, errors.ErrorCode) }
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.