app-cloudep-trade-service/internal/svc/inject_mongo.go

21 lines
487 B
Go
Raw Normal View History

2024-10-25 16:42:58 +00:00
package svc
import (
"app-cloudep-trade-service/internal/config"
mgo "app-cloudep-trade-service/internal/lib/mongo"
model "app-cloudep-trade-service/internal/model/mongo"
)
// MustOrderModel 連線 order mongo 時
func MustOrderModel(c config.Config) model.OrderModel {
orderCollection := model.Order{}
return model.NewOrderModel(
mgo.MustMongoConnectURL(c),
c.Mongo.Database,
orderCollection.CollectionName(),
mgo.SetCustomDecimalType(),
mgo.InitMongoOptions(c),
)
}