toolkits

package module
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 4 Imported by: 0

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.:

  1. registry: The registry package is register implementation for the main package definition.

The Toolkit currently offers the following packages:

  1. codec: A set of utilities for serializing and deserializing data in a variety of formats.
  2. errors: Enhanced error handling utilities, such as error wrapping, context propagation, and error inspection.
  3. idgen: A package for generating unique identifiers.

Getting Started

To incorporate the Toolkit into your project, follow these steps:
  1. 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.
  1. Import required packages:
  • In your Go source files, import the necessary packages from the Toolkit:
import (
"github.com/origadmin/toolkits/errors"
"github.com/origadmin/runtime"
//    "github.com/origadmin/runtime/xxx"
"github.com/origadmin/runtime/config"
"github.com/origadmin/contrib"
//    "github.com/origadmin/contrib/xxx"    
"github.com/origadmin/contrib/config"
)
  1. 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.

Call relationships intro

In OrigAdmin, the call relationship between packages is as follows:

  • Contrib : in view of the toolkits interface, the realization of the runtime and kratos.

  • Runtime : encapsulates the kratos runtime required interfaces, including basic functions, initialize the application, as well as the service registry, service discovery, etc.

    • runtime/registry : provide basic service registry found the function definition.
    • runtime/config : provide configuration file is read and parse the definition of the configuration of the analytic function.
  • Toolkit : toolkits provide some of the basic function of the general interface definition or implementation, such as the serialization and deserialization, error handling, a unique identifier generated, etc.

    • toolkits/codec : provide a variety of formats data serialization and deserialization.
    • toolkit/errors : provide enhanced error handling utility, such as wrong packaging, context propagation and error checking.
your_project --> contrib --> contrib/config --> runtime --> toolkits
             --> contrib/config
             --> runtime --> rumtime/registry
             --> rumtime/registry
             --> toolkits
             --> toolkits/codec
             --> toolkits/errors
             --> other_package
graph LR
A(your_project) 
A --> B(contrib)
A --> C(runtime)
A --> D(toolkits)
B --> E(contrib/config)
C --> F(runtime/config)
C --> G(runtime/registry)
D --> H(toolkits/codec)
D --> I(toolkits/errors)

Contributing

We welcome contributions from the community to improve and expand the Toolkit. To contribute, please follow these guidelines:

  1. Familiarize yourself with the project: Read the CONTRIBUTING file for details on the contribution process, code style, and Pull Request requirements.
  2. 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.
  3. 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

Alt

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

Overview

Package toolkits implements the functions, types, and interfaces for the module.

Directories

Path Synopsis
cmd
codec module
contrib
cache Module
casbin Module
config Module
consul Module
database Module
dbo/ent Module
etcd Module
framework/gin Module
mail 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 functions for generating random salt strings.
Package rand provides functions for generating random salt strings.
Package database implements the functions, types, and interfaces for the module.
Package database implements the functions, types, and interfaces for the module.
Package env implements the functions, types, and interfaces for the module.
Package env implements the functions, types, and interfaces for the module.
errors module
examples module
Package fileupload implements the functions, types, and interfaces for the module.
Package fileupload implements the functions, types, and interfaces for the module.
Package helpers implements the functions, types, and interfaces for the module.
Package helpers implements the functions, types, and interfaces for the module.
ident module
idgen module
Package io is the input/output package
Package io is the input/output package
Package mail provides a mail client
Package mail provides a mail client
Package metrics provides the metrics recorder
Package metrics provides the metrics recorder
net
Package net implements the functions, types, and interfaces for the module.
Package net implements the functions, types, and interfaces for the module.
filter
Package linkFilter for Toolkits
Package linkFilter for Toolkits
pagination
Package pagination implements the functions, types, and interfaces for the module.
Package pagination implements the functions, types, and interfaces for the module.
nats Module
redis Module
registry
database Module
orm/ent Module
runtime module
kratos Module
Package security implements the functions, types, and interfaces for the module.
Package security implements the functions, types, and interfaces for the module.
sloge module
storage
cache
Package cache implements the functions, types, and interfaces for the module.
Package cache implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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