Awesome
<p align="left"> English  |  <a href="README_CN.md">中文</a> </p> <img src="docs/assert/logo.png" width = "100" alt="logo" align=center />Gone
What Is Gone?
Gone is a lightweight dependency injection framework for Golang, designed to integrate with a variety of third-party components, enabling rapid development of cloud-native microservices.
Features
- Dependency injection: Supports automatic injection of struct fields and function parameters.
- Gonectr: Generates projects, auxiliary code, compiles, and starts the project.
- Unit testing solution: Mock testing based on interfaces.
- Multiple pluggable components: Supports cloud-native and microservices architectures.
Quick Start
- Install gonectr and mockgen
go install github.com/gone-io/gonectr@latest go install go.uber.org/mock/mockgen@latest
- Create a new project
gonectr create myproject
- Run the project
Or use run Make command if you have installed make:cd myproject gonectr run ./cmd/server
Or with docker compose:cd myproject make run
cd myproject docker compose build docker compose up
Full Documentation
Contributing
If you have a bug report or feature request, you can open an issue, and pull requests are also welcome.
Changelog
v1.2.1
- Introduced gone.Provider, a factory function for injecting external components (such as structs, struct pointers, functions, and interfaces) that are not Goner into Goners filed which tag by
gone
. - Fixed an issue where
gone.NewProviderPriest
failed to create a Priest for gone.Provider instances that generate interface types. - Added test cases for
goner/gorm
and completed other missing test cases; updated documentation accordingly.
v1.2.0
- Introduced a new
gone.GonerOption
, enabling type-based injection by delegating the task of constructing injected type instances to a Goner that implementsSuck(conf string, v reflect.Value, field reflect.StructField) error
. - Added a helper function for implementing Goner Provider:
func NewProviderPriest[T any, P any](fn func(tagConf string, param P) (T, error)) Priest
. - Provided a strategy configuration solution for the cluster mode in
goner/xorm
. - Improved the
goner/gorm
code and conducted functional tests to support integration with multiple databases.
v1.1.1
goner/xorm
now supports clustering and multiple databases. Latest documentation: https://goner.fun/references/xorm.html- Added
goner/gorm
, a wrapper forgorm.io/gorm
for database access. Currently, only MySQL is supported, and improvements are ongoing.
Contact
If you have questions, feel free to reach out to us in the following ways:
License
gone
released under MIT license, refer LICENSE file.