mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
refactor(channelserver): move remaining s.server.db calls into repositories
Eliminate the last three direct DB accesses from handler code: - CharacterRepo.LoadSaveData: replaces db.Query in GetCharacterSaveData, using QueryRow instead of Query+Next for cleaner single-row access - EventRepo.GetEventQuests, UpdateEventQuestStartTime, BeginTx: moves event quest enumeration and rotation queries behind the repo layer - UserRepo.BanUser: consolidates permanent/temporary ban upserts into a single method with nil/*time.Time semantics
This commit is contained in:
@@ -224,3 +224,15 @@ func (r *CharacterRepository) SaveHouseData(charID uint32, houseTier []byte, hou
|
||||
houseTier, houseData, bookshelf, gallery, tore, garden, charID)
|
||||
return err
|
||||
}
|
||||
|
||||
// LoadSaveData reads the core save columns for a character.
|
||||
// Returns charID, savedata, isNewCharacter, name, and any error.
|
||||
func (r *CharacterRepository) LoadSaveData(charID uint32) (uint32, []byte, bool, string, error) {
|
||||
var id uint32
|
||||
var savedata []byte
|
||||
var isNew bool
|
||||
var name string
|
||||
err := r.db.QueryRow("SELECT id, savedata, is_new_character, name FROM characters WHERE id = $1", charID).
|
||||
Scan(&id, &savedata, &isNew, &name)
|
||||
return id, savedata, isNew, name, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user