From 1fc176d67968dfa19a7c31be2eba22c304a3882b Mon Sep 17 00:00:00 2001 From: Paolo Galeone Date: Thu, 3 Apr 2014 09:46:51 +0200 Subject: [PATCH] Format code with gofmt --- scope.go | 32 ++++++++++++++++---------------- scope_private.go | 16 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/scope.go b/scope.go index 9b5df96a..1ff169e4 100644 --- a/scope.go +++ b/scope.go @@ -13,14 +13,14 @@ import ( ) type Scope struct { - Value interface{} - Search *search - Sql string - SqlVars []interface{} - db *DB - _values map[string]interface{} - skipLeft bool - primaryKey string + Value interface{} + Search *search + Sql string + SqlVars []interface{} + db *DB + _values map[string]interface{} + skipLeft bool + primaryKey string } // NewScope create scope for callbacks, including DB's search information @@ -79,11 +79,11 @@ func (scope *Scope) HasError() bool { // PrimaryKey get the primary key's column name func (scope *Scope) PrimaryKey() string { - if scope.primaryKey != "" { - return scope.primaryKey - } + if scope.primaryKey != "" { + return scope.primaryKey + } - scope.primaryKey = scope.getPrimaryKey() + scope.primaryKey = scope.getPrimaryKey() return scope.primaryKey } @@ -247,10 +247,10 @@ func (scope *Scope) Fields() []*Field { // Search for primary key tag identifier field.isPrimaryKey = scope.PrimaryKey() == field.DBName || fieldStruct.Tag.Get("primaryKey") != "" - fmt.Printf("Name: %s\n isPrimaryKey: %v\n\n",field.DBName, field.isPrimaryKey) - if field.isPrimaryKey { - scope.primaryKey = field.DBName - } + fmt.Printf("Name: %s\n isPrimaryKey: %v\n\n", field.DBName, field.isPrimaryKey) + if field.isPrimaryKey { + scope.primaryKey = field.DBName + } if scope.db != nil { field.Tag = fieldStruct.Tag diff --git a/scope_private.go b/scope_private.go index 71f50408..ecee1477 100644 --- a/scope_private.go +++ b/scope_private.go @@ -5,12 +5,12 @@ import ( "database/sql/driver" "errors" "fmt" + "go/ast" "reflect" "regexp" "strconv" "strings" "time" - "go/ast" ) func (scope *Scope) primaryCondiation(value interface{}) string { @@ -488,12 +488,12 @@ func (scope *Scope) getPrimaryKey() string { continue } - // if primaryKey tag found, return column name - if fieldStruct.Tag.Get("primaryKey") != "" { - return toSnake(fieldStruct.Name) - } - } + // if primaryKey tag found, return column name + if fieldStruct.Tag.Get("primaryKey") != "" { + return toSnake(fieldStruct.Name) + } + } - //If primaryKey tag not found, fallback to id - return "id" + //If primaryKey tag not found, fallback to id + return "id" }