• Stars
    star
    100
  • Rank 333,899 (Top 7 %)
  • Language
    Go
  • Created over 4 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go 工具包,包含常用方法:aes,base64,json,mail,math,md5,rsa,time,uuid,validator...

go-util

Go 工具包,已停止维护!建议使用 go-gin-api 项目下 /pkg 目录的包。

安装

go get github.com/xinliangnote/go-util

方法

  • aes
    • aes.Encrypt
    • aes.Decrypt
  • base64
    • base64.Encode
    • base64.Decode
  • convert
    • convert.StrToInt64
    • convert.StrToInt32
    • convert.StrToInt
    • convert.StrToFloat64
    • convert.StrToByte
    • convert.IntToStr
    • convert.IntToInt32
    • convert.IntToInt64
    • convert.Int32ToInt
    • convert.Int32ToInt64
    • convert.Int64ToInt
    • convert.Int64ToInt32
    • convert.Int64ToStr
  • hashids
    • hashids.Encrypt
    • hashids.Decrypt
  • json
    • json.Encode
    • json.Decode
  • mail
    • mail.Send
  • math
    • math.RoundedFixed 小数点后 n 位 - 四舍五入
    • math.TruncRound 小数点后 n 位 - 舍去
  • md5
    • md5.MD5
  • rsa
    • rsa.PublicEncrypt
    • rsa.PrivateDecrypt
  • time
    • time.GetCurrentDate 获取当前的时间 - 字符串
    • time.GetCurrentUnix 获取当前的时间 - Unix时间戳
    • time.GetCurrentMilliUnix 获取当前的时间 - 毫秒级时间戳
    • time.GetCurrentNanoUnix 获取当前的时间 - 纳秒级时间戳
  • uuid
    • uuid.GenUUID
  • validator
    • validator.Empty

依赖

  • uuid:github.com/google/uuid
  • gomail.v2:gopkg.in/gomail.v2
  • go-hashids:github.com/speps/go-hashids

一起学习

More Repositories

1

go-gin-api

基于 Gin 进行模块化设计的 API 框架,封装了常用功能,使用简单,致力于进行快速的业务研发。比如,支持 cors 跨域、jwt 签名验证、zap 日志收集、panic 异常捕获、trace 链路追踪、prometheus 监控指标、swagger 文档生成、viper 配置文件解析、gorm 数据库组件、gormgen 代码生成工具、graphql 查询语言、errno 统一定义错误码、gRPC 的使用、cron 定时任务 等等。
Go
4,846
star
2

Go

【Go 从入门到实战】学习笔记,从零开始学 Go、Gin 框架,基本语法包括 26 个Demo,Gin 框架包括:Gin 自定义路由配置、Gin 使用 Logrus 进行日志记录、Gin 数据绑定和验证、Gin 自定义错误处理、Go gRPC Hello World... 持续更新中...
Go
3,607
star
3

Swoole

【Swoole 从入门到实战】学习笔记,从零开始学 Swoole,包括 Swoole Task,Swoole WebSocket,Swoole HTTP 服务,Swoole RPC 服务,Swoole MySQL 连接池,Swoole Redis 连接池,Swoole 压测等,其中 7 个源码分享,11 篇总结文章分享。
PHP
232
star
4

go-jaeger-demo

go jaeger 链路追踪,实现了5个服务调用的链路,支持 gRPC 和 HTTP。
Go
129
star
5

PHP

PHP 文章集锦,浮点数搞定度运算、签名验证、单点登录、安全防御、缓存技术、RPC、Composer ...
87
star
6

Encrypt

常用 Api 接口签名 加密/解密 类库。PHP AES(AES-128-CBC)、Go AES(AES-128-CBC)、PHP RSA(密钥长度 2048)、JS RSA(密钥长度 2048)、Go RSA(密钥长度 2048) ...
JavaScript
56
star
7

go-fsm-order

使用 golang 实现的订单状态机。
Go
34
star
8

vv

基于grpc-gateway的综合业务开发框架
Go
3
star