Added waypoint model and waypoints data
This commit is contained in:
commit
6437132350
5
go.mod
Normal file
5
go.mod
Normal 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
2
go.sum
Normal 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
29
main.go
Normal 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
7
waypoint.go
Normal 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
40001
waypoints.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user