1234567891011121314151617181920212223242526272829303132333435363738 |
- package dep
- import (
- "kpt-temporary-mqtt/config"
- "kpt-temporary-mqtt/module/mqtt"
- "kpt-temporary-mqtt/store/kptstore"
- "gitee.com/xuyiping_admin/pkg/di"
- )
- func DI(opts ...di.HubOption) *di.Hub {
- var hubOpts []di.HubOption
- if len(opts) != 0 {
- hubOpts = append(opts, Global())
- } else {
- hubOpts = append(hubOpts, Global())
- }
- hub, err := di.New(hubOpts...)
- if err != nil {
- panic(err)
- }
- return hub
- }
- func Global() di.HubOption {
- return di.Options(Options()...)
- }
- func Options() []di.HubOption {
- return []di.HubOption{
- // 基础依赖
- config.Module,
- kptstore.Module,
- mqtt.Module,
- }
- }
|