The current go package defines the general configuration of the service runtime, as well as the loading of the runtime configuration.
- bootstrap: The bootstrap package contains Configuration file reading and writing, initialization variable declaration, etc
- config: The files in this directory define the basic configuration of the service runtime, as well as the loading of the run configuration.
- context: The context directory defines the context interface and the context implementation.
- data: The data directory defines the data interface, caching, database, and other storage implementation.
- gen: The protobuf directory contains the definition of the protobuf protocol.
- proto: For compatibility with other languages, the interface is defined using proto files and implemented using gRPC. All proto definition files used by the Runtime are placed in 'proto' directory.
- mail: The mail directory defines the email interface and the email implementation.
- middleware: The middleware directory defines the middleware interface and the middleware
- registry: This directory defines an alias for 'kratos/v2/registry', primarily for backward compatibility and for placing import error paths.
- service: The service directory contains the definition of the service interface, which is used to define the interface of the service and the implementation of the service.
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/[email protected]
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/runtime"
"github.com/origadmin/toolkit/runtime/config"
"github.com/origadmin/toolkit/runtime/registry"
)
// NewDiscovery creates a new discovery.
func NewDiscovery(registryConfig *config.RegistryConfig) registry.Discovery {
if registryConfig == nil {
panic("no registry config")
}
discovery, err := runtime.NewDiscovery(registryConfig)
if err != nil {
panic(err)
}
return discovery
}
// NewRegistrar creates a new registrar.
func NewRegistrar(registryConfig *config.RegistryConfig) registry.Registrar {
if registryConfig == nil {
panic("no registry config")
}
registrar, err := runtime.NewRegistrar(registryConfig)
if err != nil {
panic(err)
}
return registrar
}
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.
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.
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.