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

Method convertUpdateStmt

internal/engine/dolphin/convert.go:647–673  ·  view source on GitHub ↗
(n *pcast.UpdateStmt)

Source from the content-addressed store, hash-verified

645}
646
647func (c *cc) convertUpdateStmt(n *pcast.UpdateStmt) *ast.UpdateStmt {
648 rels := c.convertTableRefsClause(n.TableRefs)
649 if len(rels.Items) != 1 {
650 panic("expected one range var")
651 }
652
653 relations := &ast.List{}
654 convertToRangeVarList(rels, relations)
655
656 // TargetList
657 list := &ast.List{}
658 for _, a := range n.List {
659 list.Items = append(list.Items, c.convertAssignment(a))
660 }
661 stmt := &ast.UpdateStmt{
662 Relations: relations,
663 TargetList: list,
664 WhereClause: c.convert(n.Where),
665 FromClause: &ast.List{},
666 ReturningList: &ast.List{},
667 WithClause: c.convertWithClause(n.With),
668 }
669 if n.Limit != nil {
670 stmt.LimitCount = c.convert(n.Limit.Count)
671 }
672 return stmt
673}
674
675func (c *cc) convertValueExpr(n *driver.ValueExpr) *ast.A_Const {
676 switch n.TexprNode.Type.GetType() {

Callers 1

convertMethod · 0.95

Calls 5

convertAssignmentMethod · 0.95
convertMethod · 0.95
convertWithClauseMethod · 0.95
convertToRangeVarListFunction · 0.85

Tested by

no test coverage detected