Parcourir la source

1.add ErrorRow function
2.add NewRow from rows

xormplus il y a 8 ans
Parent
commit
cf101d54ca
1 fichiers modifiés avec 12 ajouts et 0 suppressions
  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