v0.7.1 Latest Latest

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

Go to latest
Published: Jan 29, 2021 License: Apache-2.0 Imports: 15 Imported by: 0




  • 计算佣金

  • 2020/05/22

  • string functions

  • System info



This section is empty.


This section is empty.


func ByteToUnitSize

func ByteToUnitSize(Size interface{}) (float64, string)


func CpuUsage

func CpuUsage() string

func DeleteExtraSpace

func DeleteExtraSpace(s string) string

* 删除多余空格 * 2019/05/05

func DistributionPrice

func DistributionPrice(business map[string]string, productSpecialPrice []map[string]string, distributionPrice interface{}, percentAge interface{}, productPrice interface{}) (float64, error)


  • 计算某一商品对分销商的分销价
  • @param business 分销商信息
  • @param productSpecialPrice 分销特殊价格
  • @param distributionPrice 基础分销价
  • @param percentage 分销比例
  • @param productPrice 商品销售价
  • 2020/05/22
  • gz

func FileUsage

func FileUsage() []interface{}

func FloatAdd

func FloatAdd(str ...interface{}) float64


  • 数值相加
  • @param str 加数,加数...
  • 2020/05/22
  • gz

func FloatMul

func FloatMul(str ...interface{}) float64


  • float相乘
  • @param str 被除数,除数,保留小数位数
  • 2020/05/25
  • gz

func FloatQuo

func FloatQuo(str ...interface{}) float64


  • float相除
  • @param str 被除数,除数,保留小数位数
  • 2020/05/25
  • gz

func FloatSub

func FloatSub(str ...interface{}) float64


  • float相减
  • @param str 被减数,减数...
  • 2020/05/22
  • gz

func FormatDate

func FormatDate(str string) string

func FormatDateTime

func FormatDateTime(str string) string

func FormatUUID

func FormatUUID(buf []byte) (string, error)

func GenerateRandomBytes

func GenerateRandomBytes(size int) ([]byte, error)

GenerateRandomBytes is used to generate random bytes of given size.

func GenerateUUID

func GenerateUUID() (string, error)

GenerateUUID is used to generate a random UUID

func GetDomain

func GetDomain(req *http.Request) string


  • 取域名

func GetHost

func GetHost(req *http.Request) string


  • 取访问主机名

func GetNetConfig

func GetNetConfig() []interface{}



func GetPage

func GetPage(pageNum, pageSize interface{}) (string, string)


  • 根据第几页计算从第几行开始
  • @param pageNum 第几页
  • @param pageSize 每页几行
  • @return from,offset 开始行数,偏移量
  • 2020/05/15
  • gz

func GetRandomNumber

func GetRandomNumber(length int) string


func GetRandomString

func GetRandomString(length int) string


func IoUsage

func IoUsage() map[string]string


  • IO读写

func IsEmail added in v0.7.1

func IsEmail(email string) bool


func IsInStringArray

func IsInStringArray(arr []string, str string) bool


  • 是否存在在字符切片中

func IsMobile added in v0.7.1

func IsMobile(mobile string) bool


func LoadAverage

func LoadAverage() map[string]string


*系统负载1 5 10 分钟

func MergeStringMap

func MergeStringMap(x, y map[string]string) map[string]string

func NetBytes

func NetBytes(Iface string) []string



func NetUsage

func NetUsage() []interface{}



func NewUUID

func NewUUID() string

Simple call

func ParamsString

func ParamsString(param string) string


  • 处理传递的参数
  • @param param
  • @return
  • 2020/05/15
  • gz

func ParseUUID

func ParseUUID(uuid string) ([]byte, error)

func PutNetConfig

func PutNetConfig(mString map[string]string) error



func SetHeader

func SetHeader(w http.ResponseWriter, resp *http.Request)

func StrFirstToUpper

func StrFirstToUpper(str string) string


  • 字符串转大驼峰 ios_bbbbbbbb -> IosBbbbbbbbb

func StringJoin

func StringJoin(s ...string) string

* 连接多个字符串 * 2019/05/05

func ToFloat64

func ToFloat64(v interface{}) (float64, error)

func ToInt

func ToInt(inter interface{}) int

func ToInt64

func ToInt64(inter interface{}) int64

func ToMapStringArray

func ToMapStringArray(x interface{}) ([]map[string]string, error)


  • 转换为map string数组
  • 2021/1/5
  • gz

func ToStr

func ToStr(v interface{}) string

func ToString

func ToString(v interface{}) string

func UrlJoin

func UrlJoin(host, url string) string

* 连接url * 2019/05/05

func VipPrice

func VipPrice(productSpecialPrice []map[string]string, productPrice interface{}) (float64, error)


  • 计算某一商品的VIP价
  • @param productSpecialPrice 特殊价格
  • @param productPrice 商品销售价
  • 2020/06/05
  • gz


type Validate

type Validate struct {
	Data  []interface{}
	Title []string
	Rule  []string //多个规则使用逗号(,)隔开

func (*Validate) Check

func (v *Validate) Check() error

Jump to

Keyboard shortcuts

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