Skip to content

Commit

Permalink
Merge pull request go-gorm#896 from go-gorm/feat_abs
Browse files Browse the repository at this point in the history
feat: add abs func
  • Loading branch information
qqxhb authored Jun 21, 2023
2 parents 21d0628 + 09b8335 commit 25d257b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions field/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ func (e expr) Avg() Float64 {
return Float64{e.setE(clause.Expr{SQL: "AVG(?)", Vars: []interface{}{e.RawExpr()}})}
}

func (e expr) Abs() Float64 {
return Float64{e.setE(clause.Expr{SQL: "ABS(?)", Vars: []interface{}{e.RawExpr()}})}
}

func (e expr) Null() AssignExpr {
return e.setE(clause.Eq{Column: e.col.Name, Value: nil})
}
Expand Down

0 comments on commit 25d257b

Please sign in to comment.