Skip to content

Commit

Permalink
Merge pull request jmoiron#23 from jwfang/master
Browse files Browse the repository at this point in the history
compatible with withmock
  • Loading branch information
jmoiron committed Sep 18, 2014
2 parents 1521699 + 912290f commit 589036d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dbmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (m *DbMap) Update(list ...interface{}) (int64, error) {
// Returns an error if SetKeys has not been called on the TableMap or if
// any interface in the list has not been registered with AddTable
func (m *DbMap) Delete(list ...interface{}) (int64, error) {
return delete(m, m, list...)
return deletes(m, m, list...)
}

// Get runs a SQL SELECT to fetch a single row from the table based on the
Expand Down
7 changes: 5 additions & 2 deletions modl.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ type SqlExecutor interface {

// Compile-time check that DbMap and Transaction implement the SqlExecutor
// interface.
var _, _ SqlExecutor = &DbMap{}, &Transaction{}
var (
_ SqlExecutor = &DbMap{}
_ SqlExecutor = &Transaction{}
)

///////////////

Expand Down Expand Up @@ -203,7 +206,7 @@ func get(m *DbMap, e SqlExecutor, dest interface{}, keys ...interface{}) error {
return nil
}

func delete(m *DbMap, e SqlExecutor, list ...interface{}) (int64, error) {
func deletes(m *DbMap, e SqlExecutor, list ...interface{}) (int64, error) {
var err error
var table *TableMap
var elem reflect.Value
Expand Down
2 changes: 1 addition & 1 deletion transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (t *Transaction) Update(list ...interface{}) (int64, error) {

// Delete has the same behavior as DbMap.Delete(), but runs in a transaction.
func (t *Transaction) Delete(list ...interface{}) (int64, error) {
return delete(t.dbmap, t, list...)
return deletes(t.dbmap, t, list...)
}

// Get has the Same behavior as DbMap.Get(), but runs in a transaction.
Expand Down

0 comments on commit 589036d

Please sign in to comment.