English | 中文
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.
- 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.
- 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
If you have a bug report or feature request, you can open an issue, and pull requests are also welcome.
- 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.
- 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.
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.
If you have questions, feel free to reach out to us in the following ways:
gone
released under MIT license, refer LICENSE file.