From e6c6dabb1b93bc9c1547f5d8ff3d2d4b1a8c1663 Mon Sep 17 00:00:00 2001 From: "Erik Winter (aider)" Date: Sat, 21 Dec 2024 14:03:10 +0100 Subject: [PATCH] fix: Handle nil recurrer in PostgreSQL JSON update query --- sync/service/postgres.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sync/service/postgres.go b/sync/service/postgres.go index 2d0d8ba..9f169ff 100644 --- a/sync/service/postgres.go +++ b/sync/service/postgres.go @@ -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(`