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

21 lines
487 B
Go
Raw Normal View History

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),
)
}