diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/dbasik-api/datamaps.go | 10 | ||||
-rw-r--r-- | cmd/dbasik-api/main.go | 4 |
2 files changed, 8 insertions, 6 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} diff --git a/cmd/dbasik-api/main.go b/cmd/dbasik-api/main.go index e86f91c..f132c50 100644 --- a/cmd/dbasik-api/main.go +++ b/cmd/dbasik-api/main.go @@ -73,8 +73,8 @@ func main() { //Read connection pool settings (explained in Configuring the pool in the book) flag.IntVar(&cfg.db.maxOpenConns, "db-max-open-conns", 25, "PostgreSQL max open connections") - flag.IntVar(&cfg.db.maxIdleConns, "db-max-idel-conns", 25, "PostgreSQL max idle connections") - flag.StringVar(&cfg.db.maxIdleTime, "db-max-idel-conns", "15m", "PostgreSQL max connection idle time") + flag.IntVar(&cfg.db.maxIdleConns, "db-max-idle-conns", 25, "PostgreSQL max idle connections") + flag.StringVar(&cfg.db.maxIdleTime, "db-max-idle-time", "15m", "PostgreSQL max connection idle time") flag.Parse() |