isLogTwoArg checks if a FuncCall is log() with exactly 2 arguments.
(fc *pg_query.FuncCall)
| 397 | |
| 398 | // isLogTwoArg checks if a FuncCall is log() with exactly 2 arguments. |
| 399 | func (t *FunctionTransform) isLogTwoArg(fc *pg_query.FuncCall) bool { |
| 400 | if len(fc.Funcname) == 0 || len(fc.Args) != 2 { |
| 401 | return false |
| 402 | } |
| 403 | for _, name := range fc.Funcname { |
| 404 | if str := name.GetString_(); str != nil && strings.ToLower(str.Sval) == "log" { |
| 405 | return true |
| 406 | } |
| 407 | } |
| 408 | return false |
| 409 | } |
| 410 | |
| 411 | // replaceLogWithLnDivision replaces log(base, value) with ln(value) / ln(base). |
| 412 | func (t *FunctionTransform) replaceLogWithLnDivision(node *pg_query.Node, fc *pg_query.FuncCall) { |