From d75c80e1f9edfadbc3abd817a8d15b9276e60995 Mon Sep 17 00:00:00 2001 From: David Rauh Date: Mon, 30 Jan 2023 16:34:51 +0100 Subject: [PATCH] #10 Build tool to write/update MassBank records to database - db connection --- cmd/mb3dbtool/main.go | 7 +++++++ pkg/database/mongodb.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/mb3dbtool/main.go b/cmd/mb3dbtool/main.go index 7905807..01e6bc7 100644 --- a/cmd/mb3dbtool/main.go +++ b/cmd/mb3dbtool/main.go @@ -1,5 +1,12 @@ package main +import "github.com/MassBank/MassBank3/pkg/database" + func main() { + database, err := database.NewMongoDB() + if err != nil { + panic(err) + } + database.Connect() } diff --git a/pkg/database/mongodb.go b/pkg/database/mongodb.go index e8067b2..88b8663 100644 --- a/pkg/database/mongodb.go +++ b/pkg/database/mongodb.go @@ -50,7 +50,7 @@ func (self *Mb3MongoDB) UpdateRecord(record massbank.Massbank, add bool) error { panic("implement me") } -func newMongoDB() (*Mb3MongoDB, error) { +func NewMongoDB() (*Mb3MongoDB, error) { return &Mb3MongoDB{ user: "massbank3", pwd: "massbank3password",