LyricTian / gin-admin

A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.
http://101.42.232.163:8040
Apache License 2.0
2.57k stars 518 forks source link

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

Open gopkg-dev opened 8 months ago

gopkg-dev commented 8 months ago

类似下面这样

// 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