fix: Handle nil recurrer in PostgreSQL JSON update query
This commit is contained in:
parent
4a71d685da
commit
e6c6dabb1b
|
@ -59,13 +59,15 @@ func NewPostgres(host, port, dbname, user, password string) (*Postgres, error) {
|
|||
}
|
||||
|
||||
func (p *Postgres) Update(i item.Item, ts time.Time) error {
|
||||
var recurrerJSON []byte
|
||||
var err error
|
||||
var recurrerJSON interface{}
|
||||
if i.Recurrer != nil {
|
||||
var err error
|
||||
recurrerJSON, err = json.Marshal(i.Recurrer)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %v", ErrPostgresFailure, err)
|
||||
}
|
||||
} else {
|
||||
recurrerJSON = nil
|
||||
}
|
||||
|
||||
_, err = p.db.Exec(`
|
||||
|
|
Loading…
Reference in New Issue