24 lines
503 B
Go
24 lines
503 B
Go
package svc
|
|
|
|
import (
|
|
"app-cloudep-order-server/internal/config"
|
|
model "app-cloudep-order-server/internal/model/mongo"
|
|
"fmt"
|
|
)
|
|
|
|
func mustMongoConnectURL(c config.Config) string {
|
|
return fmt.Sprintf("%s://%s:%s",
|
|
c.Mongo.Schema,
|
|
c.Mongo.Host,
|
|
c.Mongo.Port,
|
|
)
|
|
}
|
|
|
|
// TODO 思考快取做在那邊
|
|
|
|
func MustOrderModel(c config.Config) model.OrderModel {
|
|
orderCollection := model.Order{}
|
|
|
|
return model.NewOrderModel(mustMongoConnectURL(c), c.Mongo.Database, orderCollection.CollectionName())
|
|
}
|