common

package
v0.0.0-...-f6e1648 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmountConvert

func AmountConvert(pMoney float64, pRound bool) string

AmountConvert 金额转为大写

func Base64X

func Base64X(fileName string) string

Base64X

func DrawExcel

func DrawExcel(jsonUrl, xlsxUrl string, dataInfo map[string]gjson.Result, dataDetail []gjson.Result) (string, error)

DrawExcel 绘制模板 下载模板的时候,增加了随机数,确保拿到最新的模板

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory 获取当前文件夹:windows

func GetMySqlDB

func GetMySqlDB(drive string) *gorm.DB

GetMySqlDB 链接 MySql 数据库

func GetNanoTimeLabel

func GetNanoTimeLabel() (cur string)

GetNanoTimeLabel 获取唯一的时间标识(21位)

func GetNow

func GetNow() time.Time

GetNow 获取时间

func GetParentDirectory

func GetParentDirectory(dirctory string) string

GetParentDirectory 获取父文件夹

func GetRandName

func GetRandName() string

GetRandName 获取随机姓名

func GetSqlServerDB

func GetSqlServerDB(drive string) (string, *gorm.DB)

GetSqlServerDB 链接数据库

func GetToday

func GetToday() string

GetToday 获取时间

func GetYL

func GetYL() string

GetYL 获取语录

func InitLogger

func InitLogger(filename string) *zap.SugaredLogger

InitLogger Zap var sugarLogger *zap.SugaredLogger  sugarLogger = InitLogger("./test1.log")  defer sugarLogger.Sync() sugarLogger.Infof("Success! statusCode = %s for URL %s", resp.Status, url)

func IsFileExist1

func IsFileExist1(filename string) bool

IsFileExist1 判断文件是否存在,如果存在就删除

func IsFileExist2

func IsFileExist2(filename string, filesize int64) bool

IsFileExist2 严格版本:判断文件是否存在,如果存在 & 大小不同,删除。

func IsFileExist3

func IsFileExist3(filename string, limitSize int64) bool

IsFileExist3 版本:如果存在 & < limitSize,删除。

func JoinAbsX

func JoinAbsX(folderPath string, filename string) string

JoinAbsX 获取文件夹,如果不存在就创建。创建后合并指定的文件。

func JoinX

func JoinX(folderName string, filename string) string

JoinX 获取文件夹,如果不存在就创建。创建后合并指定的文件。

func PostJson

func PostJson(url string, data interface{}) (string, error)

PostJson 提交 Json

func RandInt64

func RandInt64(min, max int64) int64

RandInt64 获取区间随机数

func RandNumber

func RandNumber(n int) string

RandNumber 获取随机数

func RandomTime

func RandomTime() string

RandomTime 获取随机时间

func RandomTime2

func RandomTime2(n int64) time.Time

RandomTime2 获取随机时间

func UUIDString

func UUIDString() string

UUIDString 生成32位UUID

func Upload

func Upload(localFile string, keyToOverwrite string, expires uint64) (string, error)

Upload 上传到七牛

Types

type Qiniu

type Qiniu struct {
	Bucket     string
	AccessKey  string
	SecrectKey string
	Domain     string
	Config     storage.Config
}

func GetQiniu

func GetQiniu(drive string) Qiniu

GetQiniu 链接七牛

type ResultModel

type ResultModel struct {
	Code  int         `json:"code"`
	Msg   string      `json:"msg"`
	Count int         `json:"count"`
	Data  interface{} `json:"data"`
}

ResultModel 通用返回值的结构体

Jump to

Keyboard shortcuts

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