mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-27 01:53:19 +01:00
refactor(channelserver): eliminate *sql.Tx from repository interfaces
Hide transaction management inside repository implementations so interfaces only expose domain types, enabling clean mocking and decoupling handlers from PostgreSQL internals. - Replace BeginTx + UpdateEventQuestStartTime with batch UpdateEventQuestStartTimes that manages its own transaction - Remove tx parameter from CreateApplication, add composite CreateApplicationWithMail for atomic scout+mail operations - Remove SendMailTx from MailRepo (sole caller migrated) - Remove database/sql import from repo_interfaces.go
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package channelserver
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
@@ -27,12 +25,6 @@ func (r *MailRepository) SendMail(senderID, recipientID uint32, subject, body st
|
||||
return err
|
||||
}
|
||||
|
||||
// SendMailTx inserts a new mail row within an existing transaction.
|
||||
func (r *MailRepository) SendMailTx(tx *sql.Tx, senderID, recipientID uint32, subject, body string, itemID, itemAmount uint16, isGuildInvite, isSystemMessage bool) error {
|
||||
_, err := tx.Exec(mailInsertQuery, senderID, recipientID, subject, body, itemID, itemAmount, isGuildInvite, isSystemMessage)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetListForCharacter loads all non-deleted mail for a character (max 32).
|
||||
func (r *MailRepository) GetListForCharacter(charID uint32) ([]Mail, error) {
|
||||
rows, err := r.db.Queryx(`
|
||||
|
||||
Reference in New Issue
Block a user