go-rel / go-rel/rel

Allow to manually specify field names that need to be updated

Open
#338 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
786
Forks
61
Avg merge
4d 11h
Merged PRs (30d)
2

Description

In some cases you need to specifically save to database only some fields from struct and do not update any others. So it would be nice to specify something like:

```go
db.Update(ctx, &t, rel.Fields("first_name", "last_name", "date_modifed"))
```

Also would be nice to specify fields in struct comments that this field should never be included in update (pk already is excluded but there are some fields that also can not be updated (like for partitioned tables etc). created_at should probably be excluded by default for example

Currently in postgres I'm having error `ERROR: modifying the partition value of rows is not allowed (SQLSTATE 0A000)` because of that and only option is to make update manually for this case

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.