فهرست منبع

Implement stringer interface for the Query type

To make logging a little nicer in downstream usage.
John Weldon 10 سال پیش
والد
کامیت
933ecf23a3
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      session.go

+ 5 - 0
session.go

@@ -434,6 +434,11 @@ type Query struct {
 	defaultTimestamp bool
 }
 
+// String implements the stringer interface.
+func (q *Query) String() string {
+	return fmt.Sprintf("Statement: %q, Values: %+v", q.stmt, q.values)
+}
+
 //Attempts returns the number of times the query was executed.
 func (q *Query) Attempts() int {
 	return q.attempts