Browse Source

[skip ci] session: move scanner docs to interface

Chris Bannister 8 years ago
parent
commit
2e7ada62e7
1 changed files with 13 additions and 11 deletions
  1. 13 11
      session.go

+ 13 - 11
session.go

@@ -1052,8 +1052,21 @@ func (iter *Iter) Columns() []ColumnInfo {
 }
 
 type Scanner interface {
+	// Next advances the row pointer to point at the next row, the row is valid until
+	// the next call of Next. It returns true if there is a row which is available to be
+	// scanned into with Scan.
+	// Next must be called before every call to Scan.
 	Next() bool
+	
+	// Scan copies the current row's columns into dest. If the length of dest does not equal
+	// the number of columns returned in the row an error is returned. If an error is encountered
+	// when unmarshalling a column into the value in dest an error is returned and the row is invalidated
+	// until the next call to Next.
+	// Next must be called before calling Scan, if it is not an error is returned.
 	Scan(...interface{}) error
+	
+	// Err returns the if there was one during iteration that resulted in iteration being unable to complete.
+	// Err will also release resources held by the iterator, the Scanner should not used after being called.
 	Err() error
 }
 
@@ -1062,10 +1075,6 @@ type iterScanner struct {
 	cols [][]byte
 }
 
-// Next advances the row pointer to point at the next row, the row is valid until
-// the next call of Next. It returns true if there is a row which is available to be
-// scanned into with Scan.
-// Next must be called before every call to Scan.
 func (is *iterScanner) Next() bool {
 	iter := is.iter
 	if iter.err != nil {
@@ -1119,11 +1128,6 @@ func scanColumn(p []byte, col ColumnInfo, dest []interface{}) (int, error) {
 	}
 }
 
-// Scan copies the current row's columns into dest. If the length of dest does not equal
-// the number of columns returned in the row an error is returned. If an error is encountered
-// when unmarshalling a column into the value in dest an error is returned and the row is invalidated
-// until the next call to Next.
-// Next must be called before calling Scan, if it is not an error is returned.
 func (is *iterScanner) Scan(dest ...interface{}) error {
 	if is.cols == nil {
 		return errors.New("gocql: Scan called without calling Next")
@@ -1154,8 +1158,6 @@ func (is *iterScanner) Scan(dest ...interface{}) error {
 	return err
 }
 
-// Err returns the if there was one during iteration that resulted in iteration being unable to complete.
-// Err will also release resources held by the iterator and should not used after being called.
 func (is *iterScanner) Err() error {
 	iter := is.iter
 	is.iter = nil