package main import ( "database/sql" "fmt" "log" ) // setup the Database func setupDatabase() *sql.DB { connStr := "user=postgres dbname=postgres sslmode=disable" db, err := sql.Open("postgres", connStr) if err != nil { log.Fatal(err) } return db } // getNames gets the name of all the challenges func getName(db *sql.DB) string { // get the current name of the challenges query := fmt.Sprintf("SELECT name FROM challenges WHERE points=200") var names string err := db.QueryRow(query).Scan(&names) if err != nil { log.Fatalf("[ E ] :", err) } return names }