30 lines
592 B
Go
30 lines
592 B
Go
package impl
|
|
|
|
import (
|
|
"github.com/infraboard/mcube/v2/ioc"
|
|
ioc_mongo "github.com/infraboard/mcube/v2/ioc/config/mongo"
|
|
"gitlab.com/go-course-project/go17/devcloud-mini/mpaas/apps/k8s"
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
)
|
|
|
|
func init() {
|
|
ioc.Controller().Registry(&K8sServiceImpl{})
|
|
}
|
|
|
|
var _ k8s.Service = (*K8sServiceImpl)(nil)
|
|
|
|
type K8sServiceImpl struct {
|
|
ioc.ObjectImpl
|
|
col *mongo.Collection
|
|
}
|
|
|
|
func (s *K8sServiceImpl) Name() string {
|
|
return k8s.AppName
|
|
}
|
|
|
|
func (s *K8sServiceImpl) Init() error {
|
|
// 定义使用的集合
|
|
s.col = ioc_mongo.DB().Collection("k8s")
|
|
return nil
|
|
}
|