Added waypoint model and waypoints data

This commit is contained in:
Luke Else 2022-01-18 12:24:30 +00:00
commit 6437132350
5 changed files with 40044 additions and 0 deletions

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module DataInputClient
go 1.17
require github.com/go-sql-driver/mysql v1.6.0 // indirect

2
go.sum Normal file
View File

@ -0,0 +1,2 @@
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=

29
main.go Normal file
View File

@ -0,0 +1,29 @@
package main
import (
"database/sql"
"encoding/json"
"fmt"
"os"
)
func main() {
//Marshall JSON into Objects
jsonString, _ := os.ReadFile("./waypoints.json")
data := []Waypoint{}
x := json.Unmarshal(jsonString, &data)
fmt.Println(string(jsonString), x)
//Open a connection to the database
db, err := sql.Open("mysql", "")
if err != nil {
}
//Make a Query to the database
db.Exec("INSERT INTO ")
//Close the connection
db.Close()
}

7
waypoint.go Normal file
View File

@ -0,0 +1,7 @@
package main
type Waypoint struct {
Coords []float64 `json:"coords"`
NavType string `json:"type"`
Name string `json:"name"`
}

40001
waypoints.json Normal file

File diff suppressed because it is too large Load Diff