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

Method convertReturning_caluseContext

internal/engine/sqlite/convert.go:926–958  ·  view source on GitHub ↗
(n parser.IReturning_clauseContext)

Source from the content-addressed store, hash-verified

924}
925
926func (c *cc) convertReturning_caluseContext(n parser.IReturning_clauseContext) *ast.List {
927 list := &ast.List{Items: []ast.Node{}}
928 if n == nil {
929 return list
930 }
931
932 r, ok := n.(*parser.Returning_clauseContext)
933 if !ok {
934 return list
935 }
936
937 for _, exp := range r.AllExpr() {
938 list.Items = append(list.Items, &ast.ResTarget{
939 Indirection: &ast.List{},
940 Val: c.convert(exp),
941 })
942 }
943
944 for _, star := range r.AllSTAR() {
945 list.Items = append(list.Items, &ast.ResTarget{
946 Indirection: &ast.List{},
947 Val: &ast.ColumnRef{
948 Fields: &ast.List{
949 Items: []ast.Node{&ast.A_Star{}},
950 },
951 Location: star.GetSymbol().GetStart(),
952 },
953 Location: star.GetSymbol().GetStart(),
954 })
955 }
956
957 return list
958}
959
960func (c *cc) convertInsert_stmtContext(n *parser.Insert_stmtContext) ast.Node {
961 tableName := identifier(n.Table_name().GetText())

Callers 3

Calls 4

convertMethod · 0.95
GetStartMethod · 0.80
AllExprMethod · 0.65
AllSTARMethod · 0.65

Tested by

no test coverage detected