columnMatches checks if a column expression matches the given name.
(expr ast.Expression, name string)
| 112 | |
| 113 | // columnMatches checks if a column expression matches the given name. |
| 114 | func columnMatches(expr ast.Expression, name string) bool { |
| 115 | lower := strings.ToLower(name) |
| 116 | switch e := expr.(type) { |
| 117 | case *ast.Identifier: |
| 118 | return strings.ToLower(e.Name) == lower |
| 119 | case *ast.AliasedExpression: |
| 120 | if strings.ToLower(e.Alias) == lower { |
| 121 | return true |
| 122 | } |
| 123 | return columnMatches(e.Expr, name) |
| 124 | default: |
| 125 | return false |
| 126 | } |
| 127 | } |
no outgoing calls
no test coverage detected