Postgres sqlx, how to connect in readonly mode

I’m using:

"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"

and connecting with:

db, err = sqlx.Open(“postgres”, symbolDbUrl)

All my queries are read only. How do I make my connection read only?

Typically permissions are handled at the database level. When you connect to the database, the connection credentials are what authenticate you and permit the allowable access (read, read/write, usage of the schema, add roles, etc.). It wouldn’t make sense to control this at the package level, but I could be wrong. At the application level, you can also control what the user has permissions to create, read, update, delete, etc. But again, this is not the database driver package but more of your application logic

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.