README
¶
Toolkit
Introduction
The Toolkit is a collection of Go-specific packages providing idiomatic solutions for common tasks encountered in Go-based software development. It aims to streamline your workflow, enhance code quality, and promote consistency across Go projects. This README focuses on the Toolkit, detailing its contents, usage, and contribution guidelines.
Key Features
- Idiomatic Go: Designed with best practices and conventions in mind, ensuring seamless integration with your existing Go codebase.
- Modular Structure: Organized into distinct packages, each addressing a specific aspect of Go development, allowing you to pick and choose the components you need.
- Well-Documented APIs: Comprehensive documentation, including package-level documentation, function comments, and usage examples, to facilitate quick understanding and adoption.
- Robust Testing: Rigorous unit tests and integration tests accompany each package, ensuring stability, reliability, and maintainability.
- Open Source & Community-Driven: The Toolkit is open-source under a permissive license, encouraging community contributions, bug reports, and feature requests.
Available Packages
The Toolkit main package is toolkit
and is the interface package.:
[registry](registry)
: The registry package is register implementation for the main package definition.
The Toolkit currently offers the following packages:
[codec](codec)
: A set of utilities for serializing and deserializing data in a variety of formats.[context](context)
: A set of utilities for managing context values and cancellation signals.[errors](errors)
: Enhanced error handling utilities, such as error wrapping, context propagation, and error inspection.[ident](ident)
: A package for generating unique identifiers.[scripts](scripts)
: A set of utilities for managing scripts and tasks.[runtime](runtime)
: The runtime package Implements some common functions in toolkits.
Getting Started
To incorporate the Toolkit into your project, follow these steps:
- Add the dependency: Add the Toolkit as a dependency in your
go.mod
file, specifying the latest version:
go get github.com/origadmin/toolkit@vX.Y.Z
Replace vX.Y.Z
with the desired version or latest
to fetch the most recent release.
- Import required packages: In your Go source files, import the necessary packages from the Toolkit:
import (
"github.com/origadmin/toolkit/errors"
"github.com/origadmin/toolkit/httpclient"
"github.com/origadmin/toolkit/jsonutil"
"github.com/origadmin/toolkit/concurrency"
"github.com/origadmin/toolkit/config"
"github.com/origadmin/toolkit/logging"
)
- Use the toolkit components: Refer to the package documentation and examples to learn how to utilize the toolkit
components in your code. You can access the documentation by running
godoc
locally or visiting the package documentation hosted on godoc.org.
Contributing
We welcome contributions from the community to improve and expand the Toolkit. To contribute, please follow these guidelines:
- Familiarize yourself with the project: Read the CONTRIBUTING file for details on the contribution process, code style, and Pull Request requirements.
- Submit an issue or proposal: If you encounter any bugs, have feature suggestions, or want to discuss potential changes, create an issue in the GitHub repository.
- Create a Pull Request: After implementing your changes, submit a Pull Request following the guidelines outlined in CONTRIBUTING.
Contributors
Code of Conduct
All contributors and participants are expected to abide by the Contributor Covenant, version 2.1. This document outlines the expected behavior when interacting with the Toolkit community.
State
License
The Toolkit is distributed under the terms of the MIT. This permissive license allows for free use, modification, and distribution of the toolkit in both commercial and non-commercial contexts.
Documentation
¶
There is no documentation for this package.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
protoc-gen-go-gin
Module
|
|
protoc-gen-go-ginrpc
Module
|
|
protoc-gen-go-gins
Module
|
|
codec
module
|
|
Package context provides the context functions
|
Package context provides the context functions |
contrib
|
|
cache
Module
|
|
casbin
Module
|
|
config
Module
|
|
consul
Module
|
|
database
Module
|
|
dbo/ent
Module
|
|
etcd
Module
|
|
framework/fiber
Module
|
|
framework/gin
Module
|
|
framework/gorilla
Module
|
|
mail
Module
|
|
metrics/opentelemetry
Module
|
|
metrics/prometheus
Module
|
|
middleware/gin
Module
|
|
middleware/logger
Module
|
|
replacer
Module
|
|
security/jwt
Module
|
|
crypto
|
|
aes
Package aes provides the AES encryption and decryption
|
Package aes provides the AES encryption and decryption |
hash
Package hash provides the hash functions
|
Package hash provides the hash functions |
rand
Package rand provides the random string
|
Package rand provides the random string |
Package errors provides a means to return detailed information for a request error, typically encoded in JSON format.
|
Package errors provides a means to return detailed information for a request error, typically encoded in JSON format. |
rpcerr
Package rpcerr provides a way to return detailed information for an RPC request error.
|
Package rpcerr provides a way to return detailed information for an RPC request error. |
examples
module
|
|
Package helpers for toolkits
|
Package helpers for toolkits |
ident
module
|
|
idgen
module
|
|
Package io is the input/output package
|
Package io is the input/output package |
Package metrics provides the metrics recorder
|
Package metrics provides the metrics recorder |
filter
Package linkFilter for Toolkits
|
Package linkFilter for Toolkits |
nats
Module
|
|
redis
Module
|
|
registry
|
|
database
Module
|
|
metrics/prometheus
Module
|
|
orm/ent
Module
|
|
runtime
module
|
|
kratos
Module
|
|
Package security is a toolkit for security check and authorization
|
Package security is a toolkit for security check and authorization |
jwt
Package token is a toolkit for authorization.
|
Package token is a toolkit for authorization. |
sloge
module
|
|
storage
|
|
utils
|
|
replacer
Package replacer provides a string Replacement mechanism with custom Replacement functions and keywords.
|
Package replacer provides a string Replacement mechanism with custom Replacement functions and keywords. |