42 lines
730 B
Go
42 lines
730 B
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
type repositorySummary struct {
|
|
firstname string
|
|
lastname string
|
|
}
|
|
|
|
type repositories struct {
|
|
Repositories []repositorySummary
|
|
}
|
|
|
|
func Index(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Welcome!")
|
|
}
|
|
//
|
|
//func queryRepos(repos *repositories) error {
|
|
// rows, err := dbCdb.Query(`SELECT * FROM friends.test`)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// defer rows.Close()
|
|
// for rows.Next() {
|
|
// repo := repositorySummary{}
|
|
// err = rows.Scan(
|
|
// &repo.firstname,
|
|
// &repo.lastname,)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// repos.Repositories = append(repos.Repositories, repo)
|
|
// }
|
|
// err = rows.Err()
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// return nil
|
|
//}
|