Assumptions:

   - You're using the html/template package:
   https://golang.org/pkg/html/template/
   - You name your database connection variable "db"
   - You name the result variable from your query "rows"
   - You're using PostgreSQL
   - You check all your errors ^_^

Steps

   - Create a DB connection named "db" using sql.Open
   - Run db.Ping() to make sure the connection is good
   - Define a struct with your two fields, making sure the field names are
   capitalized
   - Write your SQL query, safely using $1, $2, etc. for any parameters
   passed to the query
   - Run the query using db.Query
   - Defer rows.Close() to ensure your connection is returned to the pool
   - Iterate over the sql.Rows you get back with rows.Next()
   - For each row, create an instance of your struct, then
   rows.Scan(&t.Name, &t.Time)
   - Add the populated struct to a slice
   - Create and parse an html/template which iterates over its input using
   range, using the values populate the table and the URLs or forms used to
   GET or POST the update and delete requests
   - Execute the template on the http.ResponseWriter and your slice of
   structs

If you get stuck on this, please post code. Happy Saturday!

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to