diff --git a/sql.go b/interface.go similarity index 100% rename from sql.go rename to interface.go diff --git a/private.go b/main_private.go similarity index 94% rename from private.go rename to main_private.go index 2b6bceb0..fe198c1d 100644 --- a/private.go +++ b/main_private.go @@ -40,10 +40,6 @@ func (s *DB) err(err error) error { return err } -func (s *DB) hasError() bool { - return s.Error != nil -} - func (s *DB) print(v ...interface{}) { s.parent.logger.(logger).Print(v...) } diff --git a/scope.go b/scope.go index d73ddb10..5ea82983 100644 --- a/scope.go +++ b/scope.go @@ -24,6 +24,10 @@ type Scope struct { skipLeft bool } +func (scope *Scope) Quote(str string) string { + return scope.Dialect().Quote(str) +} + func (db *DB) NewScope(value interface{}) *Scope { db.Value = value return &Scope{db: db, Search: db.search, Value: value, _values: map[string]interface{}{}} @@ -71,7 +75,7 @@ func (scope *Scope) Log(v ...interface{}) { } func (scope *Scope) HasError() bool { - return scope.db.hasError() + return scope.db.Error != nil } func (scope *Scope) PrimaryKey() string { diff --git a/scope_condition.go b/scope_condition.go index fd820c8f..21f6d5a8 100644 --- a/scope_condition.go +++ b/scope_condition.go @@ -10,10 +10,6 @@ import ( "strings" ) -func (scope *Scope) Quote(str string) string { - return scope.Dialect().Quote(str) -} - func (scope *Scope) primaryCondiation(value interface{}) string { return fmt.Sprintf("(%v = %v)", scope.Quote(scope.PrimaryKey()), value) }