Fix metadata editor
Convert slices to postgres arrays.
This commit is contained in:
parent
71d975c2f7
commit
2562f4c2c8
2 changed files with 15 additions and 8 deletions
|
@ -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...).
|
||||
|
|
Reference in a new issue