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

Method convertFunctionCall

internal/engine/clickhouse/convert.go:483–518  ·  view source on GitHub ↗
(n *chast.FunctionCall)

Source from the content-addressed store, hash-verified

481}
482
483func (c *cc) convertFunctionCall(n *chast.FunctionCall) *ast.FuncCall {
484 fc := &ast.FuncCall{
485 Funcname: &ast.List{
486 Items: []ast.Node{&ast.String{Str: n.Name}},
487 },
488 Location: n.Pos().Offset,
489 AggDistinct: n.Distinct,
490 }
491
492 // Convert arguments
493 if len(n.Arguments) > 0 {
494 fc.Args = &ast.List{}
495 for _, arg := range n.Arguments {
496 fc.Args.Items = append(fc.Args.Items, c.convertExpr(arg))
497 }
498 }
499
500 // Convert window function
501 if n.Over != nil {
502 fc.Over = &ast.WindowDef{}
503 if len(n.Over.PartitionBy) > 0 {
504 fc.Over.PartitionClause = &ast.List{}
505 for _, p := range n.Over.PartitionBy {
506 fc.Over.PartitionClause.Items = append(fc.Over.PartitionClause.Items, c.convertExpr(p))
507 }
508 }
509 if len(n.Over.OrderBy) > 0 {
510 fc.Over.OrderClause = &ast.List{}
511 for _, o := range n.Over.OrderBy {
512 fc.Over.OrderClause.Items = append(fc.Over.OrderClause.Items, c.convertOrderByElement(o))
513 }
514 }
515 }
516
517 return fc
518}
519
520func (c *cc) convertParameter(n *chast.Parameter) ast.Node {
521 c.paramCount++

Callers 3

convertToResTargetMethod · 0.95
convertExprMethod · 0.95

Calls 3

convertExprMethod · 0.95
convertOrderByElementMethod · 0.95
PosMethod · 0.65

Tested by

no test coverage detected