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 {
|
||||
ob := orderBy{colName, nil, "DESC"}
|
||||
statement.orderBy = append(statement.orderBy, ob)
|
||||
if _, err := ob.CheckValid(); err != nil {
|
||||
notNil, err := ob.CheckValid()
|
||||
if err != nil {
|
||||
statement.LastError = err
|
||||
return statement
|
||||
}
|
||||
if notNil {
|
||||
statement.orderBy = append(statement.orderBy, ob)
|
||||
}
|
||||
}
|
||||
return statement
|
||||
}
|
||||
|
@ -135,11 +138,14 @@ func (statement *Statement) Asc(colNames ...string) *Statement {
|
|||
}
|
||||
for _, colName := range colNames {
|
||||
ob := orderBy{colName, nil, "ASC"}
|
||||
statement.orderBy = append(statement.orderBy, ob)
|
||||
if _, err := ob.CheckValid(); err != nil {
|
||||
notNil, err := ob.CheckValid()
|
||||
if err != nil {
|
||||
statement.LastError = err
|
||||
return statement
|
||||
}
|
||||
if notNil {
|
||||
statement.orderBy = append(statement.orderBy, ob)
|
||||
}
|
||||
}
|
||||
return statement
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue