Files
RenewCMS/internal/database/database.go
T

24 lines
375 B
Go

package database
import (
"context"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
type Location struct {
Database string
Collection string
}
func GetNewClient() *mongo.Client {
client, err := mongo.Connect(
context.TODO(),
options.Client().ApplyURI("mongodb://db:27017/"))
if err != nil {
panic(err)
}
return client
}