diff options
author | Matthew Lemon <y@yulqen.org> | 2024-04-10 19:33:21 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-04-10 19:33:21 +0100 |
commit | e69391d4f309f6268440632585bbddf3a2a5bd60 (patch) | |
tree | 9e0faa4a92f06dbd8c228ba80752ea5f4d89dd17 /cmd/dbasik-api/datamaps.go | |
parent | d36c48b3251b9da483f06318ecaa14b9a4fa7118 (diff) |
First introduction of migrations using golang-migrate
Diffstat (limited to 'cmd/dbasik-api/datamaps.go')
-rw-r--r-- | cmd/dbasik-api/datamaps.go | 10 |
1 files changed, 6 insertions, 4 deletions
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} |