From ce5c0580d837e893bbd47c10fda3f3687c545659 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Nieto?= <jose.carlos@menteslibres.net>
Date: Mon, 26 Sep 2016 13:18:44 -0500
Subject: [PATCH] Rename Config into Conf.

---
 config.go                       | 12 ++++++------
 internal/sqladapter/database.go |  6 +++---
 logger.go                       | 14 +++++++-------
 mongo/result.go                 | 10 +++++-----
 4 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/config.go b/config.go
index 4c4134e9..48b6de50 100644
--- a/config.go
+++ b/config.go
@@ -4,23 +4,23 @@ import (
 	"sync/atomic"
 )
 
-type config struct {
+type conf struct {
 	loggingEnabled uint32
 	queryLogger    atomic.Value
 }
 
-func (c *config) Logger() Logger {
+func (c *conf) Logger() Logger {
 	if lg := c.queryLogger.Load(); lg != nil {
 		return lg.(Logger)
 	}
 	return nil
 }
 
-func (c *config) SetLogger(lg Logger) {
+func (c *conf) SetLogger(lg Logger) {
 	c.queryLogger.Store(lg)
 }
 
-func (c *config) SetLogging(value bool) {
+func (c *conf) SetLogging(value bool) {
 	if value {
 		atomic.StoreUint32(&c.loggingEnabled, 1)
 		return
@@ -28,11 +28,11 @@ func (c *config) SetLogging(value bool) {
 	atomic.StoreUint32(&c.loggingEnabled, 0)
 }
 
-func (c *config) LoggingEnabled() bool {
+func (c *conf) LoggingEnabled() bool {
 	if v := atomic.LoadUint32(&c.loggingEnabled); v == 1 {
 		return true
 	}
 	return false
 }
 
-var Config = config{}
+var Conf = conf{}
diff --git a/internal/sqladapter/database.go b/internal/sqladapter/database.go
index ff76d904..1b2575f4 100644
--- a/internal/sqladapter/database.go
+++ b/internal/sqladapter/database.go
@@ -222,7 +222,7 @@ func (d *database) StatementExec(stmt *exql.Statement, args ...interface{}) (sql
 	var query string
 	var err error
 
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: query,
@@ -251,7 +251,7 @@ func (d *database) StatementQuery(stmt *exql.Statement, args ...interface{}) (*s
 	var query string
 	var err error
 
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: query,
@@ -277,7 +277,7 @@ func (d *database) StatementQueryRow(stmt *exql.Statement, args ...interface{})
 	var query string
 	var err error
 
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: query,
diff --git a/logger.go b/logger.go
index 7b388587..a29c6292 100644
--- a/logger.go
+++ b/logger.go
@@ -10,8 +10,8 @@ import (
 
 // QueryStatus represents a query after being executed.
 type QueryStatus struct {
-	SessionID uint64
-	TxID      uint64
+	SessID uint64
+	TxID   uint64
 
 	Query string
 	Args  []interface{}
@@ -40,13 +40,13 @@ const (
 
 func init() {
 	if envEnabled(EnvEnableDebug) {
-		Config.SetLogger(&defaultLogger{}) // Using default logger.
-		Config.SetLogging(true)
+		Conf.SetLogger(&defaultLogger{}) // Using default logger.
+		Conf.SetLogging(true)
 	}
 }
 
 // Logger represents a logging collector. You can pass a logging collector to
-// db.Config.SetLogger(myCollector) to make it collect db.QueryStatus messages
+// db.Conf.SetLogger(myCollector) to make it collect db.QueryStatus messages
 // after every query.
 type Logger interface {
 	Log(*QueryStatus)
@@ -54,11 +54,11 @@ type Logger interface {
 
 // Log sends a query status report to the configured logger.
 func Log(m *QueryStatus) {
-	if lg := Config.Logger(); lg != nil {
+	if lg := Conf.Logger(); lg != nil {
 		lg.Log(m)
 		return
 	}
-	log.Printf("No logger has been configured, use db.Config.SetLogger()")
+	log.Printf("No logger has been configured, use db.Conf.SetLogger()")
 }
 
 var (
diff --git a/mongo/result.go b/mongo/result.go
index 0916964d..0fa0a794 100644
--- a/mongo/result.go
+++ b/mongo/result.go
@@ -125,7 +125,7 @@ func (r *result) Select(fields ...interface{}) db.Result {
 // All dumps all results into a pointer to an slice of structs or maps.
 func (r *result) All(dst interface{}) (err error) {
 
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: fmt.Sprintf("find(%s)", mustJSON(r.queryChunks.Conditions)),
@@ -162,7 +162,7 @@ func (r *result) Group(fields ...interface{}) db.Result {
 
 // One fetches only one result from the resultset.
 func (r *result) One(dst interface{}) (err error) {
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: fmt.Sprintf("findOne(%s)", mustJSON(r.queryChunks.Conditions)),
@@ -196,7 +196,7 @@ func (r *result) Next(dst interface{}) bool {
 
 // Delete remove the matching items from the collection.
 func (r *result) Delete() (err error) {
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: fmt.Sprintf("remove(%s)", mustJSON(r.queryChunks.Conditions)),
@@ -229,7 +229,7 @@ func (r *result) Close() error {
 func (r *result) Update(src interface{}) (err error) {
 	updateSet := map[string]interface{}{"$set": src}
 
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: fmt.Sprintf("update(%s, %s)", mustJSON(r.queryChunks.Conditions), mustJSON(updateSet)),
@@ -287,7 +287,7 @@ func (r *result) query() (*mgo.Query, error) {
 
 // Count counts matching elements.
 func (r *result) Count() (total uint64, err error) {
-	if db.Config.LoggingEnabled() {
+	if db.Conf.LoggingEnabled() {
 		defer func(start time.Time) {
 			db.Log(&db.QueryStatus{
 				Query: fmt.Sprintf("find(%s).count()", mustJSON(r.queryChunks.Conditions)),
-- 
GitLab