excludedColumnRef returns the column name if the ColumnRef is an EXCLUDED.col reference, and ok=true. Returns "", false otherwise.
(ref *ast.ColumnRef)
| 123 | // excludedColumnRef returns the column name if the ColumnRef is an EXCLUDED.col |
| 124 | // reference, and ok=true. Returns "", false otherwise. |
| 125 | func excludedColumnRef(ref *ast.ColumnRef) (string, bool) { |
| 126 | if ref.Fields == nil || len(ref.Fields.Items) != 2 { |
| 127 | return "", false |
| 128 | } |
| 129 | |
| 130 | first, ok := ref.Fields.Items[0].(*ast.String) |
| 131 | if !ok || !strings.EqualFold(first.Str, excludedTable) { |
| 132 | return "", false |
| 133 | } |
| 134 | |
| 135 | second, ok := ref.Fields.Items[1].(*ast.String) |
| 136 | if !ok { |
| 137 | return "", false |
| 138 | } |
| 139 | |
| 140 | return second.Str, true |
| 141 | } |