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

Method convertCreate_table_stmtContext

internal/engine/sqlite/convert.go:109–128  ·  view source on GitHub ↗
(n *parser.Create_table_stmtContext)

Source from the content-addressed store, hash-verified

107}
108
109func (c *cc) convertCreate_table_stmtContext(n *parser.Create_table_stmtContext) ast.Node {
110 stmt := &ast.CreateTableStmt{
111 Name: parseTableName(n),
112 IfNotExists: n.EXISTS_() != nil,
113 }
114 for _, idef := range n.AllColumn_def() {
115 if def, ok := idef.(*parser.Column_defContext); ok {
116 typeName := "any"
117 if def.Type_name() != nil {
118 typeName = def.Type_name().GetText()
119 }
120 stmt.Cols = append(stmt.Cols, &ast.ColumnDef{
121 Colname: identifier(def.Column_name().GetText()),
122 IsNotNull: hasNotNullConstraint(def.AllColumn_constraint()),
123 TypeName: &ast.TypeName{Name: typeName},
124 })
125 }
126 }
127 return stmt
128}
129
130func (c *cc) convertCreate_virtual_table_stmtContext(n *parser.Create_virtual_table_stmtContext) ast.Node {
131 switch moduleName := n.Module_name().GetText(); moduleName {

Callers 1

convertMethod · 0.95

Calls 9

hasNotNullConstraintFunction · 0.85
GetTextMethod · 0.80
parseTableNameFunction · 0.70
identifierFunction · 0.70
EXISTS_Method · 0.65
AllColumn_defMethod · 0.65
Type_nameMethod · 0.65
Column_nameMethod · 0.65
AllColumn_constraintMethod · 0.65

Tested by

no test coverage detected