AliasOrIdentifier returns the alias from a column or table identifier. Returns the identifier unmodified if no alias was found.
(columnOrTableIdentifier string)
| 8 | // AliasOrIdentifier returns the alias from a column or table identifier. |
| 9 | // Returns the identifier unmodified if no alias was found. |
| 10 | func AliasOrIdentifier(columnOrTableIdentifier string) string { |
| 11 | matches := selectRegex.FindStringSubmatch(columnOrTableIdentifier) |
| 12 | |
| 13 | if len(matches) > 0 && matches[1] != "" { |
| 14 | return matches[1] |
| 15 | } |
| 16 | |
| 17 | return columnOrTableIdentifier |
| 18 | } |
no outgoing calls
searching dependent graphs…