From e570ebaf7a49673238c176b3dd82bf239703d1f1 Mon Sep 17 00:00:00 2001 From: Emile Date: Sat, 19 Oct 2019 17:27:54 +0200 Subject: updated the struct fields to exported fields --- src/db.go | 24 ++++++++++++------------ 1 file 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) -- cgit 1.4.1