This commit is contained in:
Fred Boniface 2023-07-17 12:48:36 +01:00
parent 85e37af28d
commit a6253f6cf5
8 changed files with 38 additions and 19 deletions

18
src/dbAccess/access.go Normal file
View File

@ -0,0 +1,18 @@
package dbAccess
import (
"git.fjla.uk/owlboard/go-types/pkg/database"
"fmt"
)
func init() {
fmt.Println("dbAccess/access.init() Will be used to push the component version number to the database")
}
func PutManyServices(collection string, data []database.Service) bool {
return false
}
func PrintFromDbPackage() {
fmt.Println("hello from the dbAccess package")
}

View File

@ -1,4 +1,4 @@
package database
package dbAccess
import (
"git.fjla.uk/owlboard/mq-client/helpers"
@ -19,7 +19,7 @@ var MongoClient (*mongo.Client) = initDataAccess()
func initDataAccess() (*mongo.Client) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
client, err := mongo.Connect(ctx, options.Client().ApplyURI(dbUri))
client, err := mongo.Connect(ctx, options.Client().ApplyURI(helpers.DbUri))
if err != nil {
fmt.Println(err)
helpers.Log("Error connecting to database", 4)

View File

@ -5,6 +5,7 @@ go 1.19
require go.mongodb.org/mongo-driver v1.12.0
require (
git.fjla.uk/owlboard/go-types v0.0.0-20230717113641-a1216e6e5106 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect

View File

@ -1,3 +1,7 @@
git.fjla.uk/owlboard/go-types v0.0.0-20230717112031-d30d0275718d h1:wpU+R71igyQ8kedcnlVXGxhFXbL8N7VbdcSq2gfnf0g=
git.fjla.uk/owlboard/go-types v0.0.0-20230717112031-d30d0275718d/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY=
git.fjla.uk/owlboard/go-types v0.0.0-20230717113641-a1216e6e5106 h1:1sPFYr4/gEdWGWJhB4/Y7jJYemBSZBXcWtBm7XiZqZk=
git.fjla.uk/owlboard/go-types v0.0.0-20230717113641-a1216e6e5106/go.mod h1:kG+BX9UF+yJaAVnln/QSKlTdrtKRRReezMeSk1ZLMzY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=

View File

@ -12,7 +12,7 @@ const Version string = versionNum + "-" + versionSuffix
// Environment Variables
var runtime string = getRuntime()
var dbUri string = getDbUri()
var DbUri string = getDbUri()
var NrUser string = "nil"
var NrPass string = ""

View File

@ -2,10 +2,21 @@ package main
import (
"git.fjla.uk/owlboard/mq-client/helpers"
"git.fjla.uk/owlboard/mq-client/dbAccess"
"git.fjla.uk/owlboard/go-types/pkg/database"
"fmt"
)
func main() {
helpers.Out("Initialised OwlBoard MQ Client " + helpers.Version, 0)
var stop := database.Stop
var test database.Stop = database.Stop{
PublicDeparture: nil,
WttDeparture: nil,
PublicArrival: nil,
WttArrival: nil,
IsPublic: false,
Tiploc: "Testing",
}
fmt.Println(test)
dbAccess.PrintFromDbPackage()
}

View File

@ -1,10 +0,0 @@
package database
import (
"git.fjla.uk/owlboard/mq-client/helpers"
"git.fjla.uk/owlboard/mq-client/types"
)
func PutMany(collection string, data []Service) bool {
return false
}

View File

@ -1,5 +0,0 @@
package types
type Service struct {
id string
}