MCPcopy Create free account
hub / github.com/PostHog/duckgres / isLogTwoArg

Method isLogTwoArg

transpiler/transform/functions.go:399–409  ·  view source on GitHub ↗

isLogTwoArg checks if a FuncCall is log() with exactly 2 arguments.

(fc *pg_query.FuncCall)

Source from the content-addressed store, hash-verified

397
398// isLogTwoArg checks if a FuncCall is log() with exactly 2 arguments.
399func (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).
412func (t *FunctionTransform) replaceLogWithLnDivision(node *pg_query.Node, fc *pg_query.FuncCall) {

Callers 1

TransformMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected