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

Method convertDelete_stmtContext

internal/engine/sqlite/convert.go:203–252  ·  view source on GitHub ↗
(n Delete_stmt)

Source from the content-addressed store, hash-verified

201}
202
203func (c *cc) convertDelete_stmtContext(n Delete_stmt) ast.Node {
204 if qualifiedName, ok := n.Qualified_table_name().(*parser.Qualified_table_nameContext); ok {
205
206 tableName := identifier(qualifiedName.Table_name().GetText())
207 relation := &ast.RangeVar{
208 Relname: &tableName,
209 }
210
211 if qualifiedName.Schema_name() != nil {
212 schemaName := qualifiedName.Schema_name().GetText()
213 relation.Schemaname = &schemaName
214 }
215
216 if qualifiedName.Alias() != nil {
217 alias := qualifiedName.Alias().GetText()
218 relation.Alias = &ast.Alias{Aliasname: &alias}
219 }
220
221 relations := &ast.List{}
222
223 relations.Items = append(relations.Items, relation)
224
225 delete := &ast.DeleteStmt{
226 Relations: relations,
227 WithClause: nil,
228 }
229
230 if n.WHERE_() != nil && n.Expr() != nil {
231 delete.WhereClause = c.convert(n.Expr())
232 }
233
234 if n, ok := n.(interface {
235 Returning_clause() parser.IReturning_clauseContext
236 }); ok {
237 delete.ReturningList = c.convertReturning_caluseContext(n.Returning_clause())
238 } else {
239 delete.ReturningList = c.convertReturning_caluseContext(nil)
240 }
241 if n, ok := n.(interface {
242 Limit_stmt() parser.ILimit_stmtContext
243 }); ok {
244 limitCount, _ := c.convertLimit_stmtContext(n.Limit_stmt())
245 delete.LimitCount = limitCount
246 }
247
248 return delete
249 }
250
251 return todo("convertDelete_stmtContext", n)
252}
253
254func (c *cc) convertDrop_stmtContext(n *parser.Drop_stmtContext) ast.Node {
255 if n.TABLE_() != nil || n.VIEW_() != nil {

Callers 1

convertMethod · 0.95

Calls 14

convertMethod · 0.95
GetTextMethod · 0.80
identifierFunction · 0.70
todoFunction · 0.70
Qualified_table_nameMethod · 0.65
Table_nameMethod · 0.65
Schema_nameMethod · 0.65
AliasMethod · 0.65
WHERE_Method · 0.65
ExprMethod · 0.65

Tested by

no test coverage detected