diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/db.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/db.go b/src/db.go index bea1f9c..35840c1 100644 --- a/src/db.go +++ b/src/db.go @@ -34,7 +34,7 @@ func getName(db *sql.DB) string { } // getAllChallenges gets all the challenges from the server -func getAllChallenges(db *sql.DB) []challenge { +func getAllChallenges(db *sql.DB) []Challenge { // build the query query := fmt.Sprintf("SELECT * FROM challenges") @@ -44,10 +44,10 @@ func getAllChallenges(db *sql.DB) []challenge { defer rows.Close() if err != nil { log.Printf("[ E ] getAllChallenges query: %v\n\t\t\t query: %s\n", err, query) - return []challenge{} + return []Challenge{} } - var challenges []challenge + var challenges []Challenge // iterate over the returned rows for rows.Next() { @@ -59,17 +59,17 @@ func getAllChallenges(db *sql.DB) []challenge { scanErr := rows.Scan(&name, &description, &flag, &container, &category, &points, &static) if scanErr != nil { log.Printf("[ E ] scan error: %v", scanErr) - return []challenge{} + return []Challenge{} } - newChallenge := challenge{ - name: name, - description: description, - flag: flag, - container: container, - category: category, - points: points, - static: static, + newChallenge := Challenge{ + Name: name, + Description: description, + Flag: flag, + Container: container, + Category: category, + Points: points, + Static: static, } challenges = append(challenges, newChallenge) |