github.com/openimsdk/tools@v0.0.49/README.md (about) 1 <h1 align="center" style="border-bottom: none"> 2 <b> 3 <a href="https://docs.openim.io">openim-tools</a><br> 4 </b> 5 </h1> 6 <h3 align="center" style="border-bottom: none"> 7 ⭐️ OpenIM tools. ⭐️ <br> 8 <h3> 9 10 11 <p align=center> 12 <a href="https://goreportcard.com/report/github.com/openimsdk/tools"><img src="https://goreportcard.com/badge/github.com/openimsdk/tools" alt="A+"></a> 13 <a href="https://github.com/openimsdk/tools/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22"><img src="https://img.shields.io/github/issues/openimsdk/tools/good%20first%20issue?logo=%22github%22" alt="good first"></a> 14 <a href="https://github.com/openimsdk/tools"><img src="https://img.shields.io/github/stars/openimsdk/tools.svg?style=flat&logo=github&colorB=deeppink&label=stars"></a> 15 <a href="https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q"><img src="https://img.shields.io/badge/Slack-100%2B-blueviolet?logo=slack&logoColor=white"></a> 16 <a href="https://github.com/openimsdk/tools/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-green"></a> 17 <a href="https://pkg.go.dev/github.com/openimsdk/tools"><img src="https://img.shields.io/badge/Language-Go-blue.svg"></a> 18 </p> 19 20 21 <p align="center"> 22 <a href="./README.md"><b>English</b></a> • 23 <a href="./README_zh-CN.md"><b>中文</b></a> 24 </p> 25 26 </p> 27 28 ---- 29 30 ## Project Toolkit Documentation 31 32 This project includes a series of tools and libraries applicable to OpenIM, along with some other project-provided tool supports, aimed at supporting efficient solution development. Below is an introduction to the functionalities of each module: 33 34 ## a2r 35 36 - `api2rpc.go`: A tool for converting API to RPC, used for converting HTTP API requests into RPC calls. 37 38 ## apiresp 39 40 - `format.go`, `gin.go`, `http.go`, `resp.go`: Handles the formatting, encapsulation, and sending of API responses, supporting different web frameworks. 41 42 ## checker 43 44 - `check.go`: Provides service health checks and dependency verification functions. 45 46 ## config 47 48 - `config.go`, `config_parser.go`, `config_source.go`, `manager.go`, `path.go`: Configuration management module, supporting the parsing, loading, and dynamic updating of configurations. 49 - `validation`: Provides tools and libraries for configuration validation. 50 51 ## db 52 53 - `mongo`, `pagination`, `redis`, `tx.go`: Database operation-related tools, including support for MongoDB, Redis, and transaction management. 54 55 ## discovery 56 57 - `discovery_register.go`: Service discovery and registration functions. 58 - `zookeeper`: Service discovery implementation based on Zookeeper. 59 60 ## env 61 62 - `env.go`, `env_test.go`: Environment variable management tools, including loading and parsing environment variables. 63 64 ## errs 65 66 - `code.go`, `coderr.go`, `error.go`, `predefine.go`, `relation.go`: Error code management and custom error types. 67 68 ## field 69 70 - `file.go`, `path.go`: Utilities for file operations and path generation. 71 - Related test files. 72 73 ## log 74 75 - `color.go`, `encoder.go`, `logger.go`, `sql_logger.go`, `zap.go`, `zk_logger.go`: Log management module, supporting multiple log formats and outputs. 76 77 > [!IMPORTANT] 78 > For more information about OpenIM log, please read [https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/logging.md](https://github.com/openimsdk/open-im-server/blob/main/docs/contrib/logging.md) 79 80 ## mcontext 81 82 - `ctx.go`: Context management tool, used for passing request-related information between middleware and services. 83 84 ## mq 85 86 - `kafka`: Support for message queues based on Kafka. 87 88 ## mw 89 90 - `gin.go`, `intercept_chain.go`, `rpc_client_interceptor.go`, `rpc_server_interceptor.go`: Middleware and interceptors, used for preprocessing and postprocessing of requests. 91 - `specialerror`: Special error handling module. 92 93 ## tokenverify 94 95 - `jwt_token.go`, `jwt_token_test.go`: JWT token verification and testing. 96 97 ## utils 98 99 The utils contain multiple utility libraries, such as `encoding`, `encrypt`, `httputil`, `jsonutil`, `network`, `splitter`, `stringutil`, `timeutil`: Providing various common functionalities, such as encryption, encoding, network operations, etc. 100 101 #### encoding 102 103 - `base64.go` & `base64_test.go`: Provides utility functions for Base64 encoding and decoding, and their unit tests. 104 105 #### encrypt 106 107 - `encryption.go` & `encryption_test.go`: Contains functionalities for encryption and decryption, supporting common encryption algorithms, and related unit tests. 108 109 #### goassist 110 111 - `jsonutils.go` & `jsonutils_test.go`: Provides utility functions for handling JSON data, such as parsing and generating JSON, and related unit tests. 112 113 #### httputil 114 115 - `http_client.go` & `http_client_test.go`: Encapsulates HTTP client operations, providing convenient methods for sending HTTP requests, and their unit tests. 116 117 #### jsonutil 118 119 - `interface.go`, `json.go` & `json_test.go`: Focuses on JSON data handling, including more advanced JSON operations and customized JSON parsing methods, and their unit tests. 120 121 #### network 122 123 - `ip.go` & `ip_test.go`: Provides network-related utility functions, such as parsing and validating IP addresses, and related unit tests. 124 125 #### splitter 126 127 - `splitter.go` & `splitter_test.go`: Provides tools for splitting strings, supporting various splitting strategies and complex splitting scenarios, and their unit tests. 128 129 #### stringutil 130 131 - `strings.go` & `strings_test.go`: Contains a series of utility functions for string operations, such as modifying, searching, comparing strings, and their unit tests. 132 133 #### timeutil 134 135 - `time_format.go` & `time_format_test.go`: Provides utility functions related to time, including parsing and formatting time formats, and related unit tests. 136 137 ## version 138 139 - `base.go`, `doc.go`, `types.go`, `version.go`: Version management tool, used for defining and managing project version information.