Does go-pg support regex updates?

109 Views Asked by At

go-pg is a Golang library for PostgreSQL. In SQL one could update an entire column by applying a regular expression, e.g.:

update <some-column> set x = regexp_replace(x,'^.*\/[0-9]+(.*)$', '\1hello');

Problem

According the README, one could perform a bulk update. However, no information regarding regular expression were neither found in the issue tracker, nor in the documentation.

Question

Does this library support regexp_replace updates?

1

There are 1 best solutions below

0
On BEST ANSWER

It does not support it as an ORM, but it supports plain SQL. I personally do not like to run it as such, but there seems to be no other choice when this library is used at the moment. One benefit is that the statement will be run in the flow of the go app. For example, once the file paths have been changed on disk, the database could be updated in a controlled way.