gox

package module
v0.3.23 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 0 Imported by: 0

README

gox

gox 是一个 Go 语言工具库,提供了一系列常用的功能模块,涵盖并发、网络、加密、字符串处理、时间处理、文件操作等多个领域。

包列表

并发与同步
描述
conc 并发工具集,包含原子操作、互斥锁、通道、协程池、障碍器、懒加载等
barrier 同步障碍器
chanx 通道操作工具,包含扇入扇出、管道、过滤等功能
goroutinex 协程工具
mutexx 互斥锁扩展
oncex 一次性执行组
poolx 对象池和缓冲区池
waiter 等待组扩展
asyncbatch 异步批量处理
gofer 协程池抽象接口
lazyload 懒加载组
brave 带恢复的协程执行
网络与地址
描述
addrx 网络地址工具,IP 获取、端口选择、IP 转换等
httpx HTTP 客户端/服务端工具
netx 网络工具(预留)
加密与安全
描述
cryptox 加密工具集
aesx AES 加密
hmacx HMAC 签名
md5x MD5 哈希
rsax RSA 加密与签名
shax SHA 哈希家族
tlsx TLS 配置
x509 X.509 证书工具
auth 认证工具(Basic Auth)
数据库
描述
databasex 数据库工具集
pagex 分页工具
sqls SQL 安全检查
unsafesql SQL 拼接构造器
字符串与文本
描述
stringx 字符串工具集
strconvx 字符串转换工具
textx 文本编码转换(中文、日文、韩文)
fmtx 格式化工具
时间与日期
描述
timex 时间工具集,包含日期计算、时间比较等
反射与泛型
描述
reflectx 反射工具,字段访问、类型操作等
constraintx 泛型约束工具
protox Protobuf 工具,消息克隆、切片转换等
文件与 IO
描述
filex 文件操作工具,复制、解压、遍历等
iox IO 工具,复制、关闭、长度计算等
图像处理
描述
imagex 图片处理工具,格式转换、缩放、旋转等
错误处理
描述
errorx 错误处理工具,错误链、多错误合并等
代码生成
描述
gen 代码生成工具
数据结构
描述
heapx 堆结构
listx 双向链表、无锁队列
mapx 映射工具
ringx 环形缓冲区
slicex 切片工具
sortx 排序工具
distributed 分布式工具,子集选择、序列生成等
日志
描述
slogx 日志扩展,结构化日志、上下文等
重试与退避
描述
backoff 退避算法,指数退避、斐波那契、线性等
retry 重试策略
运行时
描述
runtimex 运行时工具,堆栈获取等
osx 操作系统工具,环境变量、信号处理等
运算符
描述
operator 运算符工具,指针、三元运算符等
随机数
描述
randx 随机数工具,支持多种随机数生成器
上下文
描述
contextx 上下文工具
工具集
描述
tools 通用工具集
数学
描述
mathx 数学工具,数值比较、四舍五入等
二进制
描述
bytex 二进制数据处理工具,Diff、编辑等

安装

go get github.com/soyacen/gox

使用示例

package main

import (
    "fmt"
    "github.com/soyacen/gox/slicex"
    "github.com/soyacen/gox/strconvx"
)

func main() {
    // 切片工具
    nums := []int{3, 1, 4, 1, 5, 9, 2, 6}
    max := slicex.Max(nums)
    fmt.Println("Max:", max)

    // 字符串转换
    i, _ := strconvx.ParseInt[int]("42", 10, 0)
    fmt.Println("Parsed:", i)
}

许可证

MIT License

Documentation

Overview

Package gox provides a comprehensive collection of Go utility libraries.

Directories

Path Synopsis
bytex
diffx
Package diffp implements a basic diff algorithm equivalent to patience diff.
Package diffp implements a basic diff algorithm equivalent to patience diff.
editx
Package editx implements buffered position-based editing of byte slices.
Package editx implements buffered position-based editing of byte slices.
asyncbatch
Package asyncbatch provides asynchronous batch processing functionality that can process objects either by batch size or time interval.
Package asyncbatch provides asynchronous batch processing functionality that can process objects either by batch size or time interval.
atomicx
Package atomicx provides enhanced atomic operations that extend the standard library's atomic package
Package atomicx provides enhanced atomic operations that extend the standard library's atomic package
brave
Package brave provides utilities for handling panics in Go programs, allowing recovery from panics and converting them to errors or custom handling.
Package brave provides utilities for handling panics in Go programs, allowing recovery from panics and converting them to errors or custom handling.
gofer
Package gofer provides a simple asynchronous task executor interface.
Package gofer provides a simple asynchronous task executor interface.
oncex
Package oncex provides a mechanism to ensure functions are executed only once per key.
Package oncex provides a mechanism to ensure functions are executed only once per key.
poolx
Package poolx provides a generic object pool implementation that extends the standard library's sync.Pool.
Package poolx provides a generic object pool implementation that extends the standard library's sync.Pool.
waiter
Package waiter provides utilities to convert blocking Wait operations into channel-based notifications.
Package waiter provides utilities to convert blocking Wait operations into channel-based notifications.
databasex
unsafesql
Package unsafesql provides a set of utilities for building SQL query statements.
Package unsafesql provides a set of utilities for building SQL query statements.
Package hashring provides a consistent hash ring implementation for distributed load balancing and caching scenarios.
Package hashring provides a consistent hash ring implementation for distributed load balancing and caching scenarios.
osx
Package randx provides utilities for generating random numbers and strings.
Package randx provides utilities for generating random numbers and strings.
Package slogx provides extensions for the slog logging library.
Package slogx provides extensions for the slog logging library.

Jump to

Keyboard shortcuts

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