mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
Move remaining raw s.server.db.* queries from handler files into dedicated repository structs, completing the repository extraction effort. Also adds SaveCharacterData and SaveHouseData to CharacterRepository. Fixes guild_hunts query to select both cats_used and start columns to match the existing two-column Scan call. Adds slot index validation in GoocooRepository to prevent SQL injection via fmt.Sprintf.
21 lines
547 B
Go
21 lines
547 B
Go
package channelserver
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
)
|
|
|
|
// ScenarioRepository centralizes all database access for the scenario_counter table.
|
|
type ScenarioRepository struct {
|
|
db *sqlx.DB
|
|
}
|
|
|
|
// NewScenarioRepository creates a new ScenarioRepository.
|
|
func NewScenarioRepository(db *sqlx.DB) *ScenarioRepository {
|
|
return &ScenarioRepository{db: db}
|
|
}
|
|
|
|
// GetCounters returns all scenario counters.
|
|
func (r *ScenarioRepository) GetCounters() (*sqlx.Rows, error) {
|
|
return r.db.Queryx("SELECT scenario_id, category_id FROM scenario_counter")
|
|
}
|