From e69391d4f309f6268440632585bbddf3a2a5bd60 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Wed, 10 Apr 2024 19:33:21 +0100 Subject: First introduction of migrations using golang-migrate --- cmd/dbasik-api/datamaps.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cmd/dbasik-api/datamaps.go') diff --git a/cmd/dbasik-api/datamaps.go b/cmd/dbasik-api/datamaps.go index 8d371ab..1e668ef 100644 --- a/cmd/dbasik-api/datamaps.go +++ b/cmd/dbasik-api/datamaps.go @@ -30,6 +30,7 @@ import ( // The fields need to be exported otherwise they won't be included when encoding // the struct to json. type datamapLine struct { + ID int64 `json:"id"` Key string `json:"key"` Sheet string `json:"sheet"` DataType string `json:"datatype"` @@ -38,6 +39,7 @@ type datamapLine struct { // datamap includes a slice of datamapLine objects alongside header metadata type datamap struct { + ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` Created time.Time `json:"created"` @@ -85,10 +87,10 @@ func (app *application) createDatamapHandler(w http.ResponseWriter, r *http.Requ } dmls = append(dmls, datamapLine{ - Key: line[0], - Sheet: line[1], - DataType: line[2], - Cellref: line[3], + Key: line[1], + Sheet: line[2], + DataType: line[3], + Cellref: line[4], }) } dm = datamap{Name: dmName, Description: dmDesc, Created: time.Now(), DMLs: dmls} -- cgit v1.2.3