Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能建议] Module 是不是可以考虑使用接口 ? #150

Open
gopkg-dev opened this issue Jan 26, 2024 · 0 comments
Open

[功能建议] Module 是不是可以考虑使用接口 ? #150

gopkg-dev opened this issue Jan 26, 2024 · 0 comments

Comments

@gopkg-dev
Copy link
Contributor

类似下面这样

// Cleanup is a function does cleanup works
type Cleanup func()

// Moduler is the interface that wraps the module's method.
type Moduler interface {
	// Stringer indicates module's name
	fmt.Stringer

	// Init does initialization works and should return
	// a cleanup function.
	Init() Cleanup

	// Boot boots the module.
	Boot()

	// RegisterRoutes add routes to fiber router
	RegisterRoutes(fiber.Router)
}

https://github.com/go-dawn/dawn/blob/main/moduler.go
https://github.com/go-dawn/dawn/blob/main/sloop.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant