这是一个用Go语言编写的工具包,提供了多个实用的功能模块。
This is a toolkit written in Go language, providing multiple practical functional modules.
为 Redis、etcd 和 MongoDB 后端提供统一接口的分布式锁,支持自动续期(Watchdog)、锁丢失感知,并提供 DoWithLock 闭包封装以简化加锁和解锁操作。
A distributed lock that provides a unified interface for Redis, etcd, and MongoDB backends, featuring auto-renewal (watchdog), lock loss awareness, and a DoWithLock functional wrapper to simplify locking and unlocking.
轻量级的事件封装库,提供基本的泛型事件结构,方便在系统各处传递事件类型与负载。
A lightweight event wrapper library providing basic generic event structures for passing event types and payloads throughout the system.
提供Excel文件的读写功能,支持将Excel数据导出为JSON格式,可自定义导出字段和输出路径。同时支持将Excel数据结构导出为Go语言的结构体(struct)和TypeScript的接口(interface)定义。
Provides Excel file read and write functionality, supports exporting Excel data to JSON format with customizable export fields and output paths. Also supports exporting Excel data structure to Go struct and TypeScript interface definitions.
网络监听工具,支持TCP和Unix域套接字(Unix Domain Socket)两种监听方式。
Network listening tool that supports both TCP and Unix Domain Socket listening methods.
通用的权重随机选择器,支持添加带权重的元素,并提供按权重随机选择功能(Selector.Add / Selector.Draw,Draw 支持 Option 模式)。
A general-purpose weighted random selector that supports adding weighted items and selecting by weight (Selector.Add / Selector.Draw, Draw supports Option pattern).
基于 Redis Sorted Set 的在线状态存储系统,支持用户心跳记录、在线统计、用户列表查询、分页查询、批量筛选和自动清理离线用户等功能。使用 Option 模式提供灵活的配置方式。
A Redis Sorted Set based online status storage system that supports user heartbeat recording, online statistics, user list queries, pagination, batch filtering, and automatic cleanup of offline users. Uses Option pattern for flexible configuration.
用于简化 Protocol Buffers 编译流程的工具包,支持自动发现 .proto 文件,通过 protoc 生成 Go 代码并按 go_package 相对 module 分目录输出,支持多插件(如 protoc-gen-go-grain、protoc-gen-es)按 proto 文件选择性启用,并可通过 protoc-go-inject-tag 注入 @gotags struct tag。
A toolkit to simplify the Protocol Buffers compilation process. It auto-discovers .proto files, generates Go code via protoc with output split by go_package relative to the module, supports multiple plugins (e.g. protoc-gen-go-grain, protoc-gen-es) that can be selectively enabled per proto file, and can inject @gotags struct tags via protoc-go-inject-tag.
提供基于种子的随机数生成器,可用于生成确定性的随机序列。
Provides a seed-based random number generator for generating deterministic random sequences.
用于解析Go结构体的工具,提供泛型支持。
A tool for parsing Go structs with generic support.
时间流逝检查工具,通过比对上一次访问时间与当前时间,依次触发分钟、小时、天、周、月的跨越事件。支持自定义周起始日(timepass.Advance)。
A time-pass check tool that compares the last access time with the current time to trigger minute/hour/day/week/month crossing events. Supports custom week start day (timepass.Advance).
基于 Viper 的配置解析工具,支持从本地文件、.env 文件、HTTP/HTTPS、以及 etcd3 等多种远程数据源加载和解析配置文件,使用更加简便。
A Viper-based configuration parsing tool that supports loading and parsing config files from local files, .env files, HTTP/HTTPS, and remote data sources like etcd3 with ease.
提供获取本机非环回IP地址的功能。
Provides functionality to obtain local non-loopback IP addresses.
go get github.com/8liang/kit- github.com/golang-module/carbon/v2
- github.com/pkg/errors
- github.com/xuri/excelize/v2
- github.com/redis/go-redis/v9
MIT License