Hooks to execute sql queries just after getting a connection and before releasing the connection. #364
-
I want to implement row level security. Is there a way to execute the following query just after getting the connection and before releasing the connection. Database: Postgres |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This sort of has nothing to do with Bob 😅. You would have to either find a driver that allows these hooks, or wrap an existing driver to hook into the connection process. |
Beta Was this translation helpful? Give feedback.
-
If anyone is using "github.com/jackc/pgx/v5", refer to the following code. The following code creates a new *sql.DB from the pool.
|
Beta Was this translation helpful? Give feedback.
This sort of has nothing to do with Bob 😅.
You would have to either find a driver that allows these hooks, or wrap an existing driver to hook into the connection process.