MCPcopy
hub / github.com/sqlc-dev/sqlc / convertTableJoin

Method convertTableJoin

internal/engine/clickhouse/convert.go:289–328  ·  view source on GitHub ↗
(n *chast.TableJoin, left, right ast.Node)

Source from the content-addressed store, hash-verified

287}
288
289func (c *cc) convertTableJoin(n *chast.TableJoin, left, right ast.Node) *ast.JoinExpr {
290 join := &ast.JoinExpr{
291 Larg: left,
292 Rarg: right,
293 }
294
295 // Convert join type
296 switch n.Type {
297 case chast.JoinInner:
298 join.Jointype = ast.JoinTypeInner
299 case chast.JoinLeft:
300 join.Jointype = ast.JoinTypeLeft
301 case chast.JoinRight:
302 join.Jointype = ast.JoinTypeRight
303 case chast.JoinFull:
304 join.Jointype = ast.JoinTypeFull
305 case chast.JoinCross:
306 join.Jointype = ast.JoinTypeInner
307 join.IsNatural = false
308 default:
309 join.Jointype = ast.JoinTypeInner
310 }
311
312 // Convert ON clause
313 if n.On != nil {
314 join.Quals = c.convertExpr(n.On)
315 }
316
317 // Convert USING clause
318 if len(n.Using) > 0 {
319 join.UsingClause = &ast.List{}
320 for _, u := range n.Using {
321 if id, ok := u.(*chast.Identifier); ok {
322 join.UsingClause.Items = append(join.UsingClause.Items, NewIdentifier(id.Name()))
323 }
324 }
325 }
326
327 return join
328}
329
330func (c *cc) convertExpr(expr chast.Expression) ast.Node {
331 if expr == nil {

Callers 1

Calls 3

convertExprMethod · 0.95
NewIdentifierFunction · 0.70
NameMethod · 0.65

Tested by

no test coverage detected