فهرست منبع

Expanded query and batch API to support retrieving the consistency level.

Phillip Couto 11 سال پیش
والد
کامیت
9bd7e75dd8
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      session.go

+ 12 - 0
session.go

@@ -243,6 +243,12 @@ func (q *Query) Consistency(c Consistency) *Query {
 	return q
 }
 
+// GetConsistency returns the currently configured consistency level for
+// the query.
+func (q *Query) GetConsistency() Consistency {
+	return q.cons
+}
+
 // Trace enables tracing of this query. Look at the documentation of the
 // Tracer interface to learn more about tracing.
 func (q *Query) Trace(trace Tracer) *Query {
@@ -485,6 +491,12 @@ func (b *Batch) Latency() int64 {
 	return 0
 }
 
+// GetConsistency returns the currently configured consistency level for the batch
+// operation.
+func (b *Batch) GetConsistency() Consistency {
+	return b.Cons
+}
+
 // Query adds the query to the batch operation
 func (b *Batch) Query(stmt string, args ...interface{}) {
 	b.Entries = append(b.Entries, BatchEntry{Stmt: stmt, Args: args})