lib/

directory
v0.0.0-...-445d29d Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT

README

lib

基础能力

  • cast 类型转换
  • mapstructure 将map解码为结构体
  • cron 定时执行
  • sonyflake id生成器
  • uuid id生成器
  • godotenv 从文件加载环境变量
  • env 将环境变量加载到结构体
  • viper 配置管理
  • glog 日志
  • logrus 日志
  • zap 日志

数据处理

  • charts 生成统计图
  • gofakeit 数据生成
  • govalidator 数据验证
  • gocsv csv处理
  • protobuf protobuf处理
  • yaml yaml处理
  • excelize excel处理
  • exl excel处理
  • fastjson json处理
  • json json处理

客户端

  • ali 阿里云

  • aws Amazon Web Services

  • k8s k8s客户端

  • otel otel客户端

  • prometheus prometheus客户端

  • nsq nsq客户端

  • sarama kafka客户端

  • temporal temporal客户端

  • gorm 数据库orm

  • mysql mysql驱动

  • redis redis客户端

  • redsync redis分布式锁

框架

  • resty http请求库
  • swag http文档生成器
  • gin http服务框架
  • grpc rpc框架
  • zero http服务和rpc框架
  • ws websocket
  • wsg websocket
  • wsn websocket

Directories

Path Synopsis
ali
oss
权限控制 https://help.aliyun.com/document_detail/609913.html
权限控制 https://help.aliyun.com/document_detail/609913.html
ram
访问控制 https://help.aliyun.com/product/28625.html https://help.aliyun.com/document_detail/121136.html
访问控制 https://help.aliyun.com/product/28625.html https://help.aliyun.com/document_detail/121136.html
aws
https://docs.aws.amazon.com/sdk-for-go/ https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2
https://docs.aws.amazon.com/sdk-for-go/ https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2
s3
https://aws.amazon.com/cn/s3/ https://docs.aws.amazon.com/s3/
https://aws.amazon.com/cn/s3/ https://docs.aws.amazon.com/s3/
┌───────────── minute (0 - 59) │ ┌───────────── hour (0 - 23) │ │ ┌───────────── day of the month (1 - 31) │ │ │ ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; │ │ │ │ │ 7 is also Sunday on some systems) │ │ │ │ │ │ │ │ │ │ * * * * * <command to execute>
┌───────────── minute (0 - 59) │ ┌───────────── hour (0 - 23) │ │ ┌───────────── day of the month (1 - 31) │ │ │ ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; │ │ │ │ │ 7 is also Sunday on some systems) │ │ │ │ │ │ │ │ │ │ * * * * * <command to execute>
excel结构体绑定
excel结构体绑定
无需声明,直接获取json字段值 https://pkg.go.dev/github.com/valyala/fastjson fastjson parses the input JSON only once.
无需声明,直接获取json字段值 https://pkg.go.dev/github.com/valyala/fastjson fastjson parses the input JSON only once.
gin
https://github.com/gin-gonic/gin/blob/master/docs/doc.md https://gin-gonic.com/docs/examples/ https://github.com/gin-gonic/examples
https://github.com/gin-gonic/gin/blob/master/docs/doc.md https://gin-gonic.com/docs/examples/ https://github.com/gin-gonic/examples
examples/docs
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
flag.Parse must be called before any logging is done.
flag.Parse must be called before any logging is done.
随机生成
随机生成
插入操作 https://gorm.io/docs/create.html
插入操作 https://gorm.io/docs/create.html
logger
开放gorm.io/gorm/logger包的logger
开放gorm.io/gorm/logger包的logger
https://grpc.io/docs/languages/go/ https://github.com/grpc/grpc-go/tree/master/Documentation https://github.com/grpc/grpc-go/tree/master/examples
https://grpc.io/docs/languages/go/ https://github.com/grpc/grpc-go/tree/master/Documentation https://github.com/grpc/grpc-go/tree/master/examples
Fast JSON encoder/decoder compatible with encoding/json for Go
Fast JSON encoder/decoder compatible with encoding/json for Go
k8s
k8s客户端,必须先初始化 NewForFile 集群外客户端初始化 NewInCluster 集群内客户端初始化 https://github.com/kubernetes/client-go/blob/master/INSTALL.md https://github.com/kubernetes/client-go/tree/master/examples
k8s客户端,必须先初始化 NewForFile 集群外客户端初始化 NewInCluster 集群内客户端初始化 https://github.com/kubernetes/client-go/blob/master/INSTALL.md https://github.com/kubernetes/client-go/tree/master/examples
examples
集群内客户端 https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration
集群内客户端 https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration
当json解码到any接口时,接口实际类型对应关系 map[string]interface{}, for JSON objects https://pkg.go.dev/encoding/json#Unmarshal
当json解码到any接口时,接口实际类型对应关系 map[string]interface{}, for JSON objects https://pkg.go.dev/encoding/json#Unmarshal
示例 https://github.com/nsqio/nsq/tree/master/apps
示例 https://github.com/nsqio/nsq/tree/master/apps
参考SigNoz文档 https://signoz.io/docs/instrumentation/golang/
参考SigNoz文档 https://signoz.io/docs/instrumentation/golang/
https://prometheus.io/docs/guides/go-application/ https://github.com/prometheus/client_golang/tree/main/examples
https://prometheus.io/docs/guides/go-application/ https://github.com/prometheus/client_golang/tree/main/examples
https://redis.uptrace.dev/guide/ 封装 redis 客户端,基于命令封装第三方库 必须先调用 Init 进行初始化
https://redis.uptrace.dev/guide/ 封装 redis 客户端,基于命令封装第三方库 必须先调用 Init 进行初始化
Redis-based distributed mutual exclusion lock https://redis.io/docs/manual/patterns/distributed-locks/
Redis-based distributed mutual exclusion lock https://redis.io/docs/manual/patterns/distributed-locks/
非200响应码会正常返回响应,不会返回错误
非200响应码会正常返回响应,不会返回错误
https://github.com/Shopify/sarama/tree/main/examples/sasl_scram_client
https://github.com/Shopify/sarama/tree/main/examples/sasl_scram_client
sonyflake 分布式唯一id生成器 必须先调用 Init 初始化
sonyflake 分布式唯一id生成器 必须先调用 Init 初始化
https://github.com/swaggo/swag go install github.com/swaggo/swag/cmd/swag@latest swag init
https://github.com/swaggo/swag go install github.com/swaggo/swag/cmd/swag@latest swag init
封装 temporal 客户端 必须先调用 Init 初始化客户端,才能调用其它函数
封装 temporal 客户端 必须先调用 Init 初始化客户端,才能调用其它函数
ws
websocket https://www.rfc-editor.org/rfc/rfc6455 https://github.com/gobwas/ws-examples
websocket https://www.rfc-editor.org/rfc/rfc6455 https://github.com/gobwas/ws-examples
wsg
Connections support one concurrent reader and one concurrent writer.
Connections support one concurrent reader and one concurrent writer.
https://github.com/nhooyr/websocket/tree/master/examples
https://github.com/nhooyr/websocket/tree/master/examples
zap好像比logrus块 zap必须要初始化
zap好像比logrus块 zap必须要初始化
配置 直接从环境变量读取 `json:",env=SERVICE_NAME"` 或者配置yaml文件 ${SERVICE_NAME}
配置 直接从环境变量读取 `json:",env=SERVICE_NAME"` 或者配置yaml文件 ${SERVICE_NAME}

Jump to

Keyboard shortcuts

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