2021年3月10日星期三

How can I update a jsonb field partially via `typeorm` in postgresql?

I am using typeorm (https://github.com/typeorm/typeorm) as ORM library to connect to postgresql database. I saved a few columns as jsonb type. Now I need to support update a json data partially, for example,

{  firstName: xx,  lastName: xxx  }  

If I only update firstName, I don't want to override lastName in the update statement. postgresql supports json_set which I can use to update the field partially but how can I make it work with typeorm libraray?

https://stackoverflow.com/questions/66543212/how-can-i-update-a-jsonb-field-partially-via-typeorm-in-postgresql March 09, 2021 at 04:23PM

没有评论:

发表评论