mirror of https://github.com/go-gorm/gorm.git
rename some files
This commit is contained in:
parent
f1d990e92a
commit
15583e6017
|
@ -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...)
|
||||||
}
|
}
|
6
scope.go
6
scope.go
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue