mirror of
https://github.com/gone-io/gone.git
synced 2025-01-22 16:50:21 +08:00
Gone is a lightweight golang dependency injection framework; a series of Goners components are built in for rapid development of micro services.
|
||
---|---|---|
.github/workflows | ||
.idea | ||
docs | ||
example | ||
goner | ||
internal/json | ||
tools/gone | ||
.gitignore | ||
cemetery_test.go | ||
cemetery.go | ||
CODE_OF_CONDUCT.md | ||
error_test.go | ||
error.go | ||
gin_interface.go | ||
go.mod | ||
go.sum | ||
h_test.go | ||
heaven_test.go | ||
heaven.go | ||
help_test.go | ||
help.go | ||
inject_by_provider_test.go | ||
interface.go | ||
LICENSE | ||
logger_test.go | ||
logger.go | ||
mock_test.go | ||
prepare_test.go | ||
prepare.go | ||
README_CN.md | ||
README.md | ||
tomb.go | ||
version.go |
English | 中文
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.