summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-04-24 00:21:59 +0200
committerAki <please@ignore.pl>2021-04-24 00:21:59 +0200
commit1cd08ba77e97014085e7f92f9ba589039b441b5a (patch)
tree3efee64f01a70f816e6917f179f3fd72b210dfb4
parent43ff562b9432e47e7a766ce3b29e51212b01d7bd (diff)
downloadfield-1cd08ba77e97014085e7f92f9ba589039b441b5a.zip
field-1cd08ba77e97014085e7f92f9ba589039b441b5a.tar.gz
field-1cd08ba77e97014085e7f92f9ba589039b441b5a.tar.bz2
Exported models to another file
-rw-r--r--derelict.go7
-rw-r--r--models.go11
2 files changed, 12 insertions, 6 deletions
diff --git a/derelict.go b/derelict.go
index d70598e..ef0b6c3 100644
--- a/derelict.go
+++ b/derelict.go
@@ -74,12 +74,7 @@ func handleBattlesPost(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Unexpected error 1", http.StatusInternalServerError)
return
}
- type wreck struct {
- Team int `json:"team"`
- Id string `json:"id"`
- Hash string `json:"hash"`
- }
- var wrecks []wreck
+ var wrecks []Wreck
data, err := ioutil.ReadAll(r.Body)
if err != nil {
http.Error(w, "Unexpected error 2", http.StatusInternalServerError)
diff --git a/models.go b/models.go
new file mode 100644
index 0000000..d230525
--- /dev/null
+++ b/models.go
@@ -0,0 +1,11 @@
+package main
+
+type Killmail struct {
+ Id string `json:"id"`
+ Hash string `json:"hash"`
+}
+
+type Wreck struct {
+ Killmail
+ Team string `json:"team"`
+}