Fix metadata editor

Convert slices to postgres arrays.
This commit is contained in:
Las Zenow 2017-05-30 23:28:42 +00:00
parent 71d975c2f7
commit 2562f4c2c8
2 changed files with 15 additions and 8 deletions

View file

@ -4,6 +4,8 @@ import (
"strings"
"time"
"github.com/go-pg/pg"
log "github.com/cihub/seelog"
)
@ -132,7 +134,11 @@ func (db *pgDB) UpdateBook(id string, data map[string]interface{}) error {
setCondition += ", "
}
setCondition += col + " = ?"
params = append(params, val)
if col == "authors" || col == "tags" {
params = append(params, pg.Array(val))
} else {
params = append(params, val)
}
}
_, err := db.sql.Model(&Book{}).
Set(setCondition, params...).