浏览代码

1.add ErrorRow function
2.add NewRow from rows

xormplus 8 年之前
父节点
当前提交
cf101d54ca
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      rows.go

+ 12 - 0
rows.go

@@ -247,6 +247,18 @@ type Row struct {
 	err error // deferred error for easy chaining
 }
 
+// ErrorRow return an error row
+func ErrorRow(err error) *Row {
+	return &Row{
+		err: err,
+	}
+}
+
+// NewRow from rows
+func NewRow(rows *Rows, err error) *Row {
+	return &Row{rows, err}
+}
+
 func (row *Row) Columns() ([]string, error) {
 	if row.err != nil {
 		return nil, row.err