fix asc and desc clause
This commit is contained in:
parent
b48e273924
commit
70e3838441
|
@ -118,11 +118,14 @@ func (statement *Statement) Desc(colNames ...string) *Statement {
|
||||||
}
|
}
|
||||||
for _, colName := range colNames {
|
for _, colName := range colNames {
|
||||||
ob := orderBy{colName, nil, "DESC"}
|
ob := orderBy{colName, nil, "DESC"}
|
||||||
statement.orderBy = append(statement.orderBy, ob)
|
notNil, err := ob.CheckValid()
|
||||||
if _, err := ob.CheckValid(); err != nil {
|
if err != nil {
|
||||||
statement.LastError = err
|
statement.LastError = err
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
|
if notNil {
|
||||||
|
statement.orderBy = append(statement.orderBy, ob)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
|
@ -135,11 +138,14 @@ func (statement *Statement) Asc(colNames ...string) *Statement {
|
||||||
}
|
}
|
||||||
for _, colName := range colNames {
|
for _, colName := range colNames {
|
||||||
ob := orderBy{colName, nil, "ASC"}
|
ob := orderBy{colName, nil, "ASC"}
|
||||||
statement.orderBy = append(statement.orderBy, ob)
|
notNil, err := ob.CheckValid()
|
||||||
if _, err := ob.CheckValid(); err != nil {
|
if err != nil {
|
||||||
statement.LastError = err
|
statement.LastError = err
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
|
if notNil {
|
||||||
|
statement.orderBy = append(statement.orderBy, ob)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return statement
|
return statement
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue