go-toolbox

module
v0.11.60 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0

README

Go-ToolbOX

Chinese Documentation - 中文文档

Go-toolbOx is characterized by daily work requirements and extension development, encapsulated generic tool classes

stable license download release commit issues pull fork star go size contributors codecov Go Report Card Go Reference Sourcegraph

Go-toolbOx's key features are:

  • Convert: Conversion between data types, such as converting strings to integers or changing date formats from one form to another.

  • Desensitize: Remove or obfuscate sensitive information to prevent data leakage, such as removing Personally Identifiable Information (PII) or encrypting data.

  • CRC: Cyclic Redundancy Check for error detection in data transmission.

  • Error Handling: Enhanced error handling capabilities to simplify error management.

  • HTTP Extensions: Auxiliary tools for HTTP requests and responses.

  • Image Processing: Tools for image processing and manipulation.

  • JSON Handling: Lightweight data interchange format handling.

  • Location Services: Information related to IP regions and more.

  • Math Extensions: Extended functionalities for numerical computations.

  • Time Handling: Parsing, validating, manipulating, and displaying dates and times to simplify date and time handling.

  • OS Interface: Programming interfaces for interacting with the operating system.

  • Queue: Implementation of queue data structures.

  • Random Numbers: Random number generators suitable for various applications.

  • Retry Mechanism: The process of retrying an operation when it fails, commonly used for network requests and database operations to enhance system reliability.

  • Scheduling: Task scheduling tools that support the execution of timed tasks.

  • Signature: Verification of data integrity and origin, used for validating data integrity and origin, such as word signatures and message signatures.

  • SQL Builder: Tools for constructing SQL queries.

  • String Handling: Extended functionalities for string processing, providing features like formatting, splitting, and concatenation.

  • Synchronization Tools: Tools for synchronization in concurrent programming.

  • Types: Definitions and operations for various types.

  • Unit Conversion: Tools for converting between units.

  • User Agent: Tools for handling user agent strings.

  • UUID: Generation of universally unique identifiers (UUID).

  • Validator: Tools for validating data integrity, such as form validation and data format validation to ensure input data meets expected formats and rules.

  • Compression Tools: Tools related to data compression and decompression.

Getting started

Prerequisites

requires Go version 1.20 or above.

Getting

With Go's module support, go [build|run|test] automatically fetches the necessary dependencies when you add the import in your code:

import "github.com/kamalyes/go-toolbox"

Alternatively, use go get:

go get -u github.com/kamalyes/go-toolbox

Directories

Path Synopsis
pkg
contextx
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-01-09 15:55:51 * @FilePath: \go-toolbox\pkg\contextx\context.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-01-09 15:55:51 * @FilePath: \go-toolbox\pkg\contextx\context.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
convert
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-09 01:15:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-09 01:05:55 * @FilePath: \go-toolbox\pkg\convert\bytes.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-09 01:15:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-09 01:05:55 * @FilePath: \go-toolbox\pkg\convert\bytes.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
crc
* @Author: kamalyes 501893067@qq.com * @Date: 2025-06-09 17:15:16 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 10:29:15 * @FilePath: \go-toolbox\pkg\crc\config.go * @Description: CRC算法配置库 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-06-09 17:15:16 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 10:29:15 * @FilePath: \go-toolbox\pkg\crc\config.go * @Description: CRC算法配置库 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
desensitize
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-18 18:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-19 08:15:19 * @FilePath: \go-toolbox\pkg\desensitize\adapter.go * @Description: * 该文件实现了数据脱敏的功能,包括注册脱敏器和执行脱敏操作。
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-18 18:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-19 08:15:19 * @FilePath: \go-toolbox\pkg\desensitize\adapter.go * @Description: * 该文件实现了数据脱敏的功能,包括注册脱敏器和执行脱敏操作。
errorx
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-10 21:51:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-02-15 09:19:15 * @FilePath: \go-toolbox\pkg\errorx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-10 21:51:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-02-15 09:19:15 * @FilePath: \go-toolbox\pkg\errorx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
httpx
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-28 18:55:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-05-27 15:05:08 * @FilePath: \go-toolbox\pkg\httpx\client.go * @Description: HTTP 客户端实现 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-28 18:55:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-05-27 15:05:08 * @FilePath: \go-toolbox\pkg\httpx\client.go * @Description: HTTP 客户端实现 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
imgix
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-09 12:15:51 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-05-28 17:15:25 * @FilePath: \go-toolbox\pkg\imgix\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-09 12:15:51 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-05-28 17:15:25 * @FilePath: \go-toolbox\pkg\imgix\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
json
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-18 19:09:16 * @FilePath: \go-toolbox\pkg\json\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-18 19:09:16 * @FilePath: \go-toolbox\pkg\json\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
mathx
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-09 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-09 15:30:22 * @FilePath: \go-toolbox\pkg\mathx\bit.go * @Description: 位操作相关工具函数集,包含64位和大整数位掩码的生成与解析 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-09 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-09 15:30:22 * @FilePath: \go-toolbox\pkg\mathx\bit.go * @Description: 位操作相关工具函数集,包含64位和大整数位掩码的生成与解析 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
moment
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 18:16:16 * @FilePath: \go-toolbox\pkg\moment\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 18:16:16 * @FilePath: \go-toolbox\pkg\moment\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
osx
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 15:09:15 * @FilePath: \go-toolbox\pkg\osx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-11 15:09:15 * @FilePath: \go-toolbox\pkg\osx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
queue
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-10 21:51:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-11 11:26:09 * @FilePath: \go-toolbox\pkg\queue\priority_queue.go * @Description: 优先队列实现 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-10 21:51:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-11 11:26:09 * @FilePath: \go-toolbox\pkg\queue\priority_queue.go * @Description: 优先队列实现 * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
random
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-13 18:15:29 * @FilePath: \go-toolbox\pkg\random\model.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-13 18:15:29 * @FilePath: \go-toolbox\pkg\random\model.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
retry
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58
schedule
* @Author: kamalyes 501893067@qq.com * @Date: 2025-01-22 13:55:18 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-13 11:55:15 * @FilePath: \go-toolbox\pkg\schedule\constant.go * @Description: 公共配置结构和常量 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-01-22 13:55:18 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-13 11:55:15 * @FilePath: \go-toolbox\pkg\schedule\constant.go * @Description: 公共配置结构和常量 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
sign
* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-23 17:37:08 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-10-23 17:58:07 * @FilePath: \go-toolbox\pkg\sign\aes.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-23 17:37:08 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-10-23 17:58:07 * @FilePath: \go-toolbox\pkg\sign\aes.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
sqlbuilderx
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-05 20:08:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-06 11:55:16 * @FilePath: \go-toolbox\pkg\sqlbuilderx\builder.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-12-05 20:08:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-12-06 11:55:16 * @FilePath: \go-toolbox\pkg\sqlbuilderx\builder.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
stringx
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-03-04 05:15:15 * @FilePath: \go-toolbox\pkg\stringx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-03-04 05:15:15 * @FilePath: \go-toolbox\pkg\stringx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
syncx
* @Author: kamalyes 501893067@qq.com * @Date: 2025-01-05 15:08:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-01-09 15:07:15 * @FilePath: \go-toolbox\pkg\syncx\atomic.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-01-05 15:08:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-01-09 15:07:15 * @FilePath: \go-toolbox\pkg\syncx\atomic.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
types
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-13 15:55:18 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-13 15:55:18 * @FilePath: \go-toolbox\internal\kv.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-11-13 15:55:18 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-13 15:55:18 * @FilePath: \go-toolbox\internal\kv.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
units
* @Author: kamalyes 501893067@qq.com * @Date: 2025-06-17 13:15:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-17 13:55:17 * @FilePath: \go-toolbox\pkg\units\constants.go * @Description: 单位常量及单位映射定义 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-06-17 13:15:00 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-06-17 13:55:17 * @FilePath: \go-toolbox\pkg\units\constants.go * @Description: 单位常量及单位映射定义 * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
useragent
* @Author: kamalyes 501893067@qq.com * @Date: 2025-04-21 13:58:25 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-04-23 11:25:40 * @FilePath: \go-toolbox\pkg\useragent\consts.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-04-21 13:58:25 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-04-23 11:25:40 * @FilePath: \go-toolbox\pkg\useragent\consts.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
validator
* @Author: kamalyes 501893067@qq.com * @Date: 2025-02-19 10:25:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-02-19 10:25:55 * @FilePath: \go-toolbox\pkg\validator\ip.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2025-02-19 10:25:55 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2025-02-19 10:25:55 * @FilePath: \go-toolbox\pkg\validator\ip.go * @Description: * * Copyright (c) 2025 by kamalyes, All Rights Reserved.
zipx
* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-24 11:25:16 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-08 12:09:00 * @FilePath: \go-toolbox\pkg\zipx\zlib.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.
* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-24 11:25:16 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-08 12:09:00 * @FilePath: \go-toolbox\pkg\zipx\zlib.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Jump to

Keyboard shortcuts

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