rename some files

This commit is contained in:
Jinzhu 2014-01-28 16:29:42 +08:00
parent f1d990e92a
commit 15583e6017
4 changed files with 5 additions and 9 deletions

View File

@ -40,10 +40,6 @@ func (s *DB) err(err error) error {
return err return err
} }
func (s *DB) hasError() bool {
return s.Error != nil
}
func (s *DB) print(v ...interface{}) { func (s *DB) print(v ...interface{}) {
s.parent.logger.(logger).Print(v...) s.parent.logger.(logger).Print(v...)
} }

View File

@ -24,6 +24,10 @@ type Scope struct {
skipLeft bool skipLeft bool
} }
func (scope *Scope) Quote(str string) string {
return scope.Dialect().Quote(str)
}
func (db *DB) NewScope(value interface{}) *Scope { func (db *DB) NewScope(value interface{}) *Scope {
db.Value = value db.Value = value
return &Scope{db: db, Search: db.search, Value: value, _values: map[string]interface{}{}} 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 { func (scope *Scope) HasError() bool {
return scope.db.hasError() return scope.db.Error != nil
} }
func (scope *Scope) PrimaryKey() string { func (scope *Scope) PrimaryKey() string {

View File

@ -10,10 +10,6 @@ import (
"strings" "strings"
) )
func (scope *Scope) Quote(str string) string {
return scope.Dialect().Quote(str)
}
func (scope *Scope) primaryCondiation(value interface{}) string { func (scope *Scope) primaryCondiation(value interface{}) string {
return fmt.Sprintf("(%v = %v)", scope.Quote(scope.PrimaryKey()), value) return fmt.Sprintf("(%v = %v)", scope.Quote(scope.PrimaryKey()), value)
} }