about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEmile <hanemile@protonmail.com>2019-10-19 17:27:54 +0200
committerEmile <hanemile@protonmail.com>2019-10-19 17:27:54 +0200
commite570ebaf7a49673238c176b3dd82bf239703d1f1 (patch)
tree747fbf3861c742d6c6d0fef87f20db3403a23690 /src
parent8add7a7c1d72986d68e8aa1c388347e202ad0dcf (diff)
updated the struct fields to exported fields
Diffstat (limited to 'src')
-rw-r--r--src/db.go24
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)