MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / convertUpdateQuery

Method convertUpdateQuery

internal/engine/clickhouse/convert.go:858–889  ·  view source on GitHub ↗
(n *chast.UpdateQuery)

Source from the content-addressed store, hash-verified

856}
857
858func (c *cc) convertUpdateQuery(n *chast.UpdateQuery) *ast.UpdateStmt {
859 rv := &ast.RangeVar{
860 Relname: &n.Table,
861 }
862 if n.Database != "" {
863 rv.Schemaname = &n.Database
864 }
865 stmt := &ast.UpdateStmt{
866 Relations: &ast.List{
867 Items: []ast.Node{rv},
868 },
869 }
870
871 // Convert assignments
872 if len(n.Assignments) > 0 {
873 stmt.TargetList = &ast.List{}
874 for _, assign := range n.Assignments {
875 name := identifier(assign.Column)
876 stmt.TargetList.Items = append(stmt.TargetList.Items, &ast.ResTarget{
877 Name: &name,
878 Val: c.convertExpr(assign.Value),
879 })
880 }
881 }
882
883 // Convert WHERE clause
884 if n.Where != nil {
885 stmt.WhereClause = c.convertExpr(n.Where)
886 }
887
888 return stmt
889}
890
891func (c *cc) convertDeleteQuery(n *chast.DeleteQuery) *ast.DeleteStmt {
892 rv := &ast.RangeVar{

Callers 1

convertMethod · 0.95

Calls 2

convertExprMethod · 0.95
identifierFunction · 0.70

Tested by

no test coverage detected