Testing
This commit is contained in:
parent
85e37af28d
commit
a6253f6cf5
18
src/dbAccess/access.go
Normal file
18
src/dbAccess/access.go
Normal 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")
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package database
|
package dbAccess
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.fjla.uk/owlboard/mq-client/helpers"
|
"git.fjla.uk/owlboard/mq-client/helpers"
|
||||||
@ -19,7 +19,7 @@ var MongoClient (*mongo.Client) = initDataAccess()
|
|||||||
func initDataAccess() (*mongo.Client) {
|
func initDataAccess() (*mongo.Client) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
client, err := mongo.Connect(ctx, options.Client().ApplyURI(dbUri))
|
client, err := mongo.Connect(ctx, options.Client().ApplyURI(helpers.DbUri))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
helpers.Log("Error connecting to database", 4)
|
helpers.Log("Error connecting to database", 4)
|
@ -5,6 +5,7 @@ go 1.19
|
|||||||
require go.mongodb.org/mongo-driver v1.12.0
|
require go.mongodb.org/mongo-driver v1.12.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
git.fjla.uk/owlboard/go-types v0.0.0-20230717113641-a1216e6e5106 // indirect
|
||||||
github.com/golang/snappy v0.0.1 // indirect
|
github.com/golang/snappy v0.0.1 // indirect
|
||||||
github.com/klauspost/compress v1.13.6 // indirect
|
github.com/klauspost/compress v1.13.6 // indirect
|
||||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
|
||||||
|
@ -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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
|
||||||
|
@ -12,7 +12,7 @@ const Version string = versionNum + "-" + versionSuffix
|
|||||||
|
|
||||||
// Environment Variables
|
// Environment Variables
|
||||||
var runtime string = getRuntime()
|
var runtime string = getRuntime()
|
||||||
var dbUri string = getDbUri()
|
var DbUri string = getDbUri()
|
||||||
var NrUser string = "nil"
|
var NrUser string = "nil"
|
||||||
var NrPass string = ""
|
var NrPass string = ""
|
||||||
|
|
||||||
|
13
src/main.go
13
src/main.go
@ -2,10 +2,21 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.fjla.uk/owlboard/mq-client/helpers"
|
"git.fjla.uk/owlboard/mq-client/helpers"
|
||||||
|
"git.fjla.uk/owlboard/mq-client/dbAccess"
|
||||||
"git.fjla.uk/owlboard/go-types/pkg/database"
|
"git.fjla.uk/owlboard/go-types/pkg/database"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
helpers.Out("Initialised OwlBoard MQ Client " + helpers.Version, 0)
|
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()
|
||||||
}
|
}
|
@ -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
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package types
|
|
||||||
|
|
||||||
type Service struct {
|
|
||||||
id string
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user