From 282b5d872cc9f6f03276e6d32bc19fdb148f6a44 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sun, 17 Nov 2013 12:09:40 +0800 Subject: [PATCH] Document Row & Rows --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 34e30b79..495d1dca 100644 --- a/README.md +++ b/README.md @@ -678,6 +678,23 @@ db.LogMode(false) db.Debug().Where("name = ?", "jinzhu").First(&User{}) ``` +## Row & Rows + +Row & Rows is not chainable, it works just like `QueryRow` and `Query` + +```go +row := db.Where("name = ?", "jinzhu").select("name, age").Row() // (*sql.Row) +row.Scan(&name, &age) + +rows, err := db.Where("name = ?", "jinzhu").select("name, age, email").Rows() // (*sql.Rows, error) +defer rows.Close() +for rows.Next() { + ... + rows.Scan(&name, &age, &email) + ... +} +``` + ## Run Raw SQl ```go