Fix test
This commit is contained in:
parent
2b48690616
commit
a79dd93557
|
@ -89,7 +89,7 @@ func TestCountWithOthers(t *testing.T) {
|
||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
total, err := testEngine.OrderBy("`id` desc").Limit(1).Count(new(CountWithOthers))
|
total, err := testEngine.OrderBy("count(`id`) desc").Limit(1).Count(new(CountWithOthers))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.EqualValues(t, 2, total)
|
assert.EqualValues(t, 2, total)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion, includeUpdated, includeNil,
|
func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion, includeUpdated, includeNil,
|
||||||
includeAutoIncr, update bool) (bool, error) {
|
includeAutoIncr, update bool,
|
||||||
|
) (bool, error) {
|
||||||
columnMap := statement.ColumnMap
|
columnMap := statement.ColumnMap
|
||||||
omitColumnMap := statement.OmitColumnMap
|
omitColumnMap := statement.OmitColumnMap
|
||||||
unscoped := statement.unscoped
|
unscoped := statement.unscoped
|
||||||
|
@ -64,15 +65,16 @@ func (statement *Statement) ifAddColUpdate(col *schemas.Column, includeVersion,
|
||||||
// BuildUpdates auto generating update columnes and values according a struct
|
// BuildUpdates auto generating update columnes and values according a struct
|
||||||
func (statement *Statement) BuildUpdates(tableValue reflect.Value,
|
func (statement *Statement) BuildUpdates(tableValue reflect.Value,
|
||||||
includeVersion, includeUpdated, includeNil,
|
includeVersion, includeUpdated, includeNil,
|
||||||
includeAutoIncr, update bool) ([]string, []interface{}, error) {
|
includeAutoIncr, update bool,
|
||||||
|
) ([]string, []interface{}, error) {
|
||||||
table := statement.RefTable
|
table := statement.RefTable
|
||||||
allUseBool := statement.allUseBool
|
allUseBool := statement.allUseBool
|
||||||
useAllCols := statement.useAllCols
|
useAllCols := statement.useAllCols
|
||||||
mustColumnMap := statement.MustColumnMap
|
mustColumnMap := statement.MustColumnMap
|
||||||
nullableMap := statement.NullableMap
|
nullableMap := statement.NullableMap
|
||||||
|
|
||||||
var colNames = make([]string, 0)
|
colNames := make([]string, 0)
|
||||||
var args = make([]interface{}, 0)
|
args := make([]interface{}, 0)
|
||||||
|
|
||||||
for _, col := range table.Columns() {
|
for _, col := range table.Columns() {
|
||||||
ok, err := statement.ifAddColUpdate(col, includeVersion, includeUpdated, includeNil,
|
ok, err := statement.ifAddColUpdate(col, includeVersion, includeUpdated, includeNil,
|
||||||
|
|
Loading…
Reference in New Issue