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

Method convertCreateTableStmt

internal/engine/dolphin/convert.go:220–238  ·  view source on GitHub ↗
(n *pcast.CreateTableStmt)

Source from the content-addressed store, hash-verified

218}
219
220func (c *cc) convertCreateTableStmt(n *pcast.CreateTableStmt) ast.Node {
221 create := &ast.CreateTableStmt{
222 Name: parseTableName(n.Table),
223 IfNotExists: n.IfNotExists,
224 }
225 if n.ReferTable != nil {
226 create.ReferTable = parseTableName(n.ReferTable)
227 }
228 for _, def := range n.Cols {
229 create.Cols = append(create.Cols, convertColumnDef(def))
230 }
231 for _, opt := range n.Options {
232 switch opt.Tp {
233 case pcast.TableOptionComment:
234 create.Comment = opt.StrValue
235 }
236 }
237 return create
238}
239
240func convertColumnDef(def *pcast.ColumnDef) *ast.ColumnDef {
241 var vals *ast.List

Callers 1

convertMethod · 0.95

Calls 2

parseTableNameFunction · 0.70
convertColumnDefFunction · 0.70

Tested by

no test coverage detected