Files
mattermost/server
Jesse Hallam f3ec71f25f wrap instead of embedding sqlx.DB (#36510)
* wrap instead of embedding sqlx.DB

Expose helper methods that route to sqlx.DB instead of requiring callers
to sometimes access .DB directly for themselves. (We could rename this
to `.db` to emphasize that it's internal, but some callers legitimately
do need it, and it's all the same package so the diff just gets
  noisier.)

This change continues to improve our ability to avoid queries without
configured timeouts, but does not yet directly address the original
report.

Relates-to: https://mattermost.atlassian.net/browse/MM-68332

* fix contradictory comment on sqlxTxWrapper.Query

* rename DB→db and Tx→tx; add DB() accessor

Make the sqlx.DB and sqlx.Tx fields unexported within the package to
signal they are internal, while exposing a DB() method for the cases
where callers need the sqlx handle directly.

* pipe passthrough errors through checkErr for offline detection

Ensure network failures in Query, ExecContext, and QueryContext methods
mark the replica offline, consistent with all other wrapper methods.

* fix config test: DB is now a method, not a field
2026-05-12 15:22:37 +00:00
..
2026-05-11 12:29:25 +02:00
2026-04-21 02:33:20 -07:00