(m *SqlSource)
| 1618 | return true |
| 1619 | } |
| 1620 | func sqlSourceToPb(m *SqlSource) *SqlSourcePb { |
| 1621 | s := SqlSourcePb{} |
| 1622 | cols := make([]*ColumnPb, 0, len(m.cols)) |
| 1623 | for k, col := range m.cols { |
| 1624 | col.As = k |
| 1625 | cols = append(cols, col.ToPB()) |
| 1626 | } |
| 1627 | s.Columns = cols |
| 1628 | s.Final = m.final |
| 1629 | s.Seekable = m.Seekable |
| 1630 | s.Raw = m.Raw |
| 1631 | s.Name = m.Name |
| 1632 | s.Alias = m.Alias |
| 1633 | s.Op = int32(m.Op) |
| 1634 | s.LeftOrRight = int32(m.LeftOrRight) |
| 1635 | s.JoinType = int32(m.JoinType) |
| 1636 | if len(m.alias) > 0 { |
| 1637 | s.AliasInner = &m.alias |
| 1638 | } |
| 1639 | kvs := make([]KvInt, 0, len(m.colIndex)) |
| 1640 | for k, v := range m.colIndex { |
| 1641 | kvs = append(kvs, KvInt{K: k, V: int32(v)}) |
| 1642 | } |
| 1643 | s.ColIndex = kvs |
| 1644 | if len(m.joinNodes) > 0 { |
| 1645 | s.JoinNodes = expr.NodesPbFromNodes(m.joinNodes) |
| 1646 | } |
| 1647 | // We get into recursive hell if we don't bail |
| 1648 | // but need to go stich in source? |
| 1649 | if m.Source != nil { |
| 1650 | //u.Warnf("about to descend? %p", m.Source) |
| 1651 | s.Source = sqlSelectToPbDepth(m.Source, 1) |
| 1652 | } |
| 1653 | if m.SubQuery != nil { |
| 1654 | s.SubQuery = SqlSelectToPb(m.SubQuery) |
| 1655 | } |
| 1656 | if m.JoinExpr != nil { |
| 1657 | s.JoinExpr = m.JoinExpr.NodePb() |
| 1658 | } |
| 1659 | |
| 1660 | return &s |
| 1661 | } |
| 1662 | func SqlSourceFromPb(pb *SqlSourcePb) *SqlSource { |
| 1663 | s := SqlSource{ |
| 1664 | final: pb.GetFinal(), |
no test coverage detected