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

Method convertBinaryExpr

internal/engine/clickhouse/convert.go:449–481  ·  view source on GitHub ↗
(n *chast.BinaryExpr)

Source from the content-addressed store, hash-verified

447}
448
449func (c *cc) convertBinaryExpr(n *chast.BinaryExpr) ast.Node {
450 op := strings.ToUpper(n.Op)
451
452 // Handle logical operators
453 if op == "AND" || op == "OR" {
454 var boolop ast.BoolExprType
455 if op == "AND" {
456 boolop = ast.BoolExprTypeAnd
457 } else {
458 boolop = ast.BoolExprTypeOr
459 }
460 return &ast.BoolExpr{
461 Boolop: boolop,
462 Args: &ast.List{
463 Items: []ast.Node{
464 c.convertExpr(n.Left),
465 c.convertExpr(n.Right),
466 },
467 },
468 Location: n.Pos().Offset,
469 }
470 }
471
472 // Handle other operators
473 return &ast.A_Expr{
474 Name: &ast.List{
475 Items: []ast.Node{&ast.String{Str: n.Op}},
476 },
477 Lexpr: c.convertExpr(n.Left),
478 Rexpr: c.convertExpr(n.Right),
479 Location: n.Pos().Offset,
480 }
481}
482
483func (c *cc) convertFunctionCall(n *chast.FunctionCall) *ast.FuncCall {
484 fc := &ast.FuncCall{

Callers 1

convertExprMethod · 0.95

Calls 2

convertExprMethod · 0.95
PosMethod · 0.65

Tested by

no test coverage detected