MCPcopy Create free account
hub / github.com/araddon/qlbridge / SqlSourceFromPb

Function SqlSourceFromPb

rel/sql.go:1662–1693  ·  view source on GitHub ↗
(pb *SqlSourcePb)

Source from the content-addressed store, hash-verified

1660 return &s
1661}
1662func SqlSourceFromPb(pb *SqlSourcePb) *SqlSource {
1663 s := SqlSource{
1664 final: pb.GetFinal(),
1665 alias: pb.GetAliasInner(),
1666 colIndex: MapIntFromPb(pb.GetColIndex()),
1667 joinNodes: expr.NodesFromNodesPbPtr(pb.GetJoinNodes()),
1668 Raw: pb.GetRaw(),
1669 Name: pb.GetName(),
1670 Alias: pb.GetAlias(),
1671 Op: lex.TokenType(pb.GetOp()),
1672 LeftOrRight: lex.TokenType(pb.GetLeftOrRight()),
1673 JoinType: lex.TokenType(pb.GetJoinType()),
1674 JoinExpr: expr.NodeFromNodePb(pb.GetJoinExpr()),
1675 Seekable: pb.GetSeekable(),
1676 }
1677 if pb.Source != nil {
1678 s.Source = SqlSelectFromPb(pb.Source)
1679 } else {
1680 //u.Debugf("no source for SqlSource? %+v", pb)
1681 }
1682 if pb.SubQuery != nil {
1683 s.SubQuery = SqlSelectFromPb(pb.SubQuery)
1684 }
1685 if len(pb.Columns) > 0 {
1686 s.cols = make(map[string]*Column, len(pb.Columns))
1687 for _, pbc := range pb.Columns {
1688 col := columnFromPb(pbc)
1689 s.cols[col.As] = col
1690 }
1691 }
1692 return &s
1693}
1694
1695func (m *SqlWhere) Keyword() lex.TokenType { return m.Op }
1696func (m *SqlWhere) writeDialectDepth(depth int, w expr.DialectWriter) {

Callers 3

SourceFromPBFunction · 0.92
SqlSelectFromPbFunction · 0.85
FromPBMethod · 0.85

Calls 15

NodesFromNodesPbPtrFunction · 0.92
TokenTypeTypeAlias · 0.92
NodeFromNodePbFunction · 0.92
MapIntFromPbFunction · 0.85
SqlSelectFromPbFunction · 0.85
columnFromPbFunction · 0.85
GetAliasInnerMethod · 0.80
GetColIndexMethod · 0.80
GetJoinNodesMethod · 0.80
GetLeftOrRightMethod · 0.80
GetJoinTypeMethod · 0.80
GetJoinExprMethod · 0.80

Tested by

no test coverage detected