CopyRewrite Create a new copy of this column for rewrite purposes removing alias
(alias string)
| 810 | |
| 811 | // CopyRewrite Create a new copy of this column for rewrite purposes removing alias |
| 812 | func (m *Column) CopyRewrite(alias string) *Column { |
| 813 | left, right, _ := m.LeftRight() |
| 814 | newCol := m.Copy() |
| 815 | //u.Warnf("in rewrite: Alias:'%s' '%s'.'%s' sourcefield:'%v'", alias, left, right, m.SourceField) |
| 816 | if left == alias { |
| 817 | newCol.SourceField = right |
| 818 | newCol.right = right |
| 819 | } |
| 820 | if newCol.Expr != nil { |
| 821 | _, right, _ := expr.LeftRight(newCol.Expr.String()) |
| 822 | if right == m.SourceField { |
| 823 | newCol.Expr = &expr.IdentityNode{Text: right} |
| 824 | } |
| 825 | } |
| 826 | return newCol |
| 827 | } |
| 828 | |
| 829 | // Copy - deep copy, shared nothing |
| 830 | func (m *Column) Copy() *Column { |
no test coverage detected