-
Hello. Query example:
is it possible to pass Of course, in this simplified example it can be hardcoded, but it's need when I want to use time from app OR from db conditionally. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Your first example is not possible. At the PostgreSQL protocol level a bound parameter is a value not a SQL expression. With |
Beta Was this translation helpful? Give feedback.
-
We are trying to use only db time in such fields to get predictable times that don't depend on app servers. |
Beta Was this translation helpful? Give feedback.
-
I just added e.g. pgxutil.InsertRow(ctx, conn, "people", map[string]any{"name": "John", "updated_at": pgxutil.SQLValue("now()")}) I don't anticipate changing this feature, but continue to bear in mind that pgxutil is an experimental package and may change. |
Beta Was this translation helpful? Give feedback.
Your first example is not possible. At the PostgreSQL protocol level a bound parameter is a value not a SQL expression.
With
pgxutil.UpdateRow
it is not possible at the present. I've wanted that feature myself, but have not yet determined a good solution. Hopefully in the future.