good morning!!!!

Skip to content
Snippets Groups Projects
Commit 69f69e3e authored by José Carlos Nieto's avatar José Carlos Nieto
Browse files

Adding an example for #13.

parent 87c3754f
Branches
Tags
No related merge requests found
package main
import (
"database/sql"
"fmt"
"github.com/gosexy/db"
_ "github.com/gosexy/db/mysql"
"github.com/gosexy/db/util/sqlutil"
)
var settings = db.DataSource{
......@@ -63,4 +65,19 @@ func main() {
fmt.Printf("animal: %s, young: %s\n", item["animal"], item["young"])
}
// Custom SQL
drv := sess.Driver().(*sql.DB)
rows, err := drv.Query("SELECT * from animals")
items = []db.Item{}
// Empty virtual table
vtable := &sqlutil.T{}
vtable.FetchRows(&items, rows)
for _, item := range items {
fmt.Printf("animal: %s, young: %s\n", item["animal"], item["young"])
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment