Documentation ¶
Overview ¶
@Time : 2019/5/14 11:26 @Author : Lukebryan @File : hmacsha256util.go @Software: GoLand
@Time : 2019/5/14 9:30 @Author : Lukebryan @File : httputil.go @Software: GoLand
@Time : 2019/5/8 16:20 @Author : Lukebryan @File : md5.go @Software: GoLand
@Time : 2019/5/14 10:40 @Author : Lukebryan @File : tokenutil.go @Software: GoLand
Index ¶
- Variables
- func BubbleSort(sort []float64, num int) float64
- func CloneRepo(repoDir string, branch string, gitAdd string) bool
- func CopyFile(dstName, srcName string) (written int64, err error)
- func CreateNumberStr(figures int, startNumber int) string
- func CreateRandNum(figures int, rang int) (numberStr string)
- func Defer(tx *gorm.DB, flag *bool)
- func DownLoadFile(u iris.Context, allFileName string, newFileName string) error
- func ExecCommand(commandName string, params []string) bool
- func ExportExcel1(header []string, data interface{})
- func GenerateRandomNumber(end int, count int) []int
- func GenerateRandomNumber2(end int, count int) []int
- func GentToken(userID string, wechat_id string) string
- func GetChineseSize(str string) int
- func GetCurrentYear() string
- func GetDayString(time string) string
- func GetDayStringNoTail(time string) string
- func GetEnglishOrSymbol(str string) int
- func GetEnglishOrSymbolChineseSize(str string) int
- func GetFloatToString(f float64) string
- func GetMD5String(strings string) string
- func GetMonthString(time string) string
- func GetMonthStringNoTail(time string) string
- func GetNginxTemplate(root string, port string, locations []string) (template string)
- func GetPidByProcessName(name string) string
- func GetRand(result int, groupExpertNumber int) (ids []int)
- func GetSimilarity(str1, str2 string) float64
- func GetTimeNow() *time.Time
- func GetTimeStringNow() string
- func GetTimeStringNowNoTail() string
- func GetTimeUnix() string
- func GetYearString(time string) string
- func GetYearStringNoTail(time string) string
- func HmacSha256Encode(strings string, secret string) string
- func InitProducer(str string)
- func Krand(size int, kind int) []byte
- func Md5ByByte(bytes []byte) string
- func MkDirs(dir string) bool
- func NewServer(ServerAddress string, ConsulAddress []string, BasePath string) *server.Server
- func PathExists(path string) (bool, error)
- func PostFormRequest(path string, datas map[string]interface{}, headers map[string]string) (resultBody string, err error)
- func PostRequest(r *http.Request, path string) (resultBody string, err error)
- func Publish(topic string, message string) error
- func ReadExcel(path string, fileName string) [][]string
- func RemoveRep(s []uint) []uint
- func Round(x float64) int
- func SplitCommandAndExec(text string) (success bool)
- func StringFormatTime(times string) time.Time
- func SubTime(str string) string
- func Substr(str string, start int, length int) string
- func Substr2(str string, start int, end int) string
- func TimeFormatString(time time.Time) string
- func TrimHtml(src string) string
- func TrimHtml2(src string) string
- func UniqueId() string
- func UpFile(u iris.Context) (string, string)
- func UploadFile(u iris.Context) string
- func UploadFile2(u iris.Context) string
- func UploadFiles(u iris.Context) string
- func WriteFile(filePath string, fileName string, fileContent string) bool
- type Excel
- type FilePathConf
- type JsonStruct
- type RpcConf
- type Set
Constants ¶
This section is empty.
Variables ¶
var FilePath = FilePathConf{}
var Producer *nsq.Producer
var RpcConfig = &RpcConf{}
Functions ¶
func BubbleSort ¶
冒泡排序找出数组中最大或者最小的数据 num=1为最大 num=2为最小
func CloneRepo ¶
Clone项目 repoDir string 项目保存地址(Git本地仓库) branch string 项目分支(Git分支) gitAdd string 项目git地址(Git地址)
func CreateNumberStr ¶
创建数字字符串(不足前面补0) CreateNumberStr(4,0) return 0001 CreateNumberStr(5,1) return 00002
func CreateRandNum ¶
创建多位数长度数字字符串 figures位数 rang随机数范围
func DownLoadFile ¶
文件下载
func ExecCommand ¶
执行命令函数 commandName 命名名称,如cat,ls,git等 params 命令参数,如ls -l的-l,git log 的log等
func ExportExcel1 ¶
func ExportExcel1(header []string, data interface{})
func GenerateRandomNumber ¶
func GenerateRandomNumber2 ¶
func GetEnglishOrSymbolChineseSize ¶
获取提取完后字符串后的长度
func GetMD5String ¶
func GetMonthStringNoTail ¶
截取时间字符串中的月份没有小尾巴2019-01-04
func GetNginxTemplate ¶
root:静态文件地址 例如:/home/vue/dist/test port:监听端口 例如:9527
func GetPidByProcessName ¶
func HmacSha256Encode ¶
func PathExists ¶
func DownLoadFiles(u iris.Context, allFileName string, newFileName string) { a := u.ResponseWriter() file, err := os.Open(allFileName) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) } defer file.Close() a.Header().Set("Content-Disposition", "attachment; filename="+newFileName) a.Header().Set("Content-Type", u.Request().Header.Get("Content-Type")) io.Copy(a, file) }
判断文件夹是否存在
func PostFormRequest ¶
func PostFormRequest(path string, datas map[string]interface{}, headers map[string]string) (resultBody string, err error)
form表单post请求
func PostRequest ¶
原样请求
func UploadFile2 ¶
Types ¶
type FilePathConf ¶
type JsonStruct ¶
type JsonStruct struct{}
读取json配置文件
func NewJsonStruct ¶
func NewJsonStruct() *JsonStruct
func (*JsonStruct) Load ¶
func (jst *JsonStruct) Load(filename string, v interface{})