Giter VIP home page Giter VIP logo

kgo's Introduction

kgo

k`s golang helper/library/utils
golang 常用函数库/工具集,仅测试支持64位linux

文档

GoDoc Go Report Card Build Status codecov Code Size Starts Version

函数接收器

  • KFile 为文件操作,如
chk := KFile.IsExist(filename)
  • KStr 为字符串操作,如
res := KStr.Trim(" hello world ")
  • KNum 为数值操作,如
res := KNum.NumberFormat(123.4567890, 3, ".", "")
  • KArr 为数组(切片/字典)操作,如
mp := map[string]string{
    "a": "aa",
    "b": "bb",
}
chk := KArr.InArray("bb", mp)	
  • KTime 为时间操作,如
res, err := KTime.Str2Timestamp("2019-07-11 10:11:23")
  • KConv 为类型转换操作,如
res := KConv.ToStr(false)
  • KOS 为系统和网络操作,如
res, err := KOS.LocalIP()
  • KEncr 为加密操作,如
res, err := KEncr.PasswordHash([]byte("123456"))
  • KDbug 为调试操作,如
KDbug.DumpStacks()

具体函数请查看godoc,更多示例请参考*_test.go文件.

测试

#单元测试
go test

#压测
time go test -bench=. -run=none
time go test -v -bench=. -cpu=4 -benchtime="10s" -timeout="15s" -benchmem

#代码覆盖率
go test -cover #概览

go test -coverprofile=coverage.out #生成统计信息
go test -v -covermode=count -coverprofile=coverage.out
go tool cover -func=coverage.out #查看统计信息
go tool cover -html=coverage.out #将统计信息转换为html

#性能分析
time go test -bench=. -benchmem -memprofile memprofile.out -cpuprofile profile.out
go tool pprof profile.out
go tool pprof -http=192.168.1.2:8081 /usr/bin/dot profile.out

更新日志

详见[CHANGELOG]

鸣谢

感谢JetBrains的赞助.
JetBrains

kgo's People

Contributors

kakuilan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.