Browse Source

documented Iter and SnappyCompressor

Christoph Hack 12 years ago
parent
commit
9f1b21f87b
2 changed files with 17 additions and 0 deletions
  1. 3 0
      conn.go
  2. 14 0
      session.go

+ 3 - 0
conn.go

@@ -486,6 +486,9 @@ type Compressor interface {
 	Decode(data []byte) ([]byte, error)
 }
 
+// SnappyCompressor implements the Compressor interface and can be used to
+// compress incoming and outgoing frames. The snappy compression algorithm
+// aims for very high speeds and reasonable compression.
 type SnappyCompressor struct{}
 
 func (s SnappyCompressor) Name() string {

+ 14 - 0
session.go

@@ -112,6 +112,9 @@ func (q *Query) Scan(dest ...interface{}) error {
 	return iter.Close()
 }
 
+// Iter represents an iterator that can be used to iterate over all rows that
+// were returned by a query. The iterator might send additional queries to the
+// database during the iteration if paging was enabled.
 type Iter struct {
 	err       error
 	pos       int
@@ -121,10 +124,19 @@ type Iter struct {
 	pageState []byte
 }
 
+// Columns returns the name and type of the selected columns.
 func (iter *Iter) Columns() []ColumnInfo {
 	return iter.columns
 }
 
+// Scan consumes the next row of the iterator and copies the columns of the
+// current row into the values pointed at by dest. Scan might send additional
+// queries to the database to retrieve the next set of rows if paging was
+// enabled.
+//
+// Scan returns true if the row was successfully unmarshaled or false if the
+// end of the result set was reached or if an error occurred. Close should
+// be called afterwards to retrieve any potential errors.
 func (iter *Iter) Scan(dest ...interface{}) bool {
 	if iter.err != nil {
 		return false
@@ -153,6 +165,8 @@ func (iter *Iter) Scan(dest ...interface{}) bool {
 	return true
 }
 
+// Close closes the iterator and returns any errors that happened during
+// the query or the iteration.
 func (iter *Iter) Close() error {
 	return iter.err
 }