Documentation ¶
Index ¶
- func CWD() string
- func CielInt(a, b uint) int
- func CielInt64(a, b uint) int64
- func CielUint(a, b uint) uint
- func CielUint64(a, b uint) uint64
- func GetFuncName() string
- func GormErrorFilter(err error) error
- func IsGormNotFound(err error) bool
- func Printf(title string, value interface{})
- func Println(content string)
- func QrCodeBase64(content string) string
- func RandFloat64() float64
- func RandInt(min int, max int) int
- func RandString(len int) string
- func StrDeleteSpace(str string) string
- type Crontab
- func (c *Crontab) AddByFunc(id string, spec string, f func()) error
- func (c *Crontab) AddByID(id string, spec string, cmd cron.Job) error
- func (c *Crontab) DelByID(id string)
- func (c *Crontab) IDs() []string
- func (c *Crontab) IsExists(jid string) bool
- func (c *Crontab) Start()
- func (c *Crontab) Stop()
- type Paging
- type RandomAllocate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CielUint64 ¶ added in v0.3.2
func GormErrorFilter ¶ added in v0.4.4
func IsGormNotFound ¶
func QrCodeBase64 ¶
func RandFloat64 ¶
func RandFloat64() float64
func RandString ¶
func StrDeleteSpace ¶ added in v0.3.7
Types ¶
type Crontab ¶
type Crontab struct {
// contains filtered or unexported fields
}
Crontab crontab manager
type Paging ¶
type Paging struct { Page uint //current page number PageSize uint //list items number in per page TotalItem uint //rows number in database TotalPage uint //the count of all pages DBType string //type of database,mysql or postgresql }
func PagingGenerator ¶ added in v0.3.0
func (*Paging) GetQueryBegin ¶
func (*Paging) GetQueryLimit ¶ added in v0.3.0
type RandomAllocate ¶ added in v0.4.1
type RandomAllocate struct { AmountTotal decimal.Decimal //总金额 MaxOffsetPercent decimal.Decimal //最大偏差比例 CountTotal uint //要分配的次数 ResultArrayAmount []decimal.Decimal //返回金额结果 ResultArrayPercent []decimal.Decimal //返回比例结果 // contains filtered or unexported fields }
按一定偏差分配总金额
var m = randomAllocate{ AmountTotal: decimal.NewFromFloat(1243.0), CountTotal: 42, MaxOffsetPercent: decimal.NewFromFloat(0.3), }
a, p := m.run()
totalAmount := decimal.NewFromInt(0) totalPercent := decimal.NewFromInt(0)
for i, v := range a { //GU.Printf("\n分配金额"+v.String(), " 比例"+p[i].String()) fmt.Println(v.String()) totalAmount = totalAmount.Add(v) totalPercent = totalPercent.Add(p[i]) }
GU.Printf("合计金额 ", totalAmount.String()) GU.Printf("合计比例 ", totalPercent.String())
Source Files ¶
Click to show internal directories.
Click to hide internal directories.