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

Method convertColumnDeclaration

internal/engine/clickhouse/convert.go:821–856  ·  view source on GitHub ↗
(n *chast.ColumnDeclaration)

Source from the content-addressed store, hash-verified

819}
820
821func (c *cc) convertColumnDeclaration(n *chast.ColumnDeclaration) *ast.ColumnDef {
822 colDef := &ast.ColumnDef{
823 Colname: identifier(n.Name),
824 IsNotNull: isNotNull(n),
825 }
826
827 if n.Type != nil {
828 colDef.TypeName = &ast.TypeName{
829 Name: n.Type.Name,
830 }
831 // Handle type parameters (e.g., Decimal(10, 2))
832 if len(n.Type.Parameters) > 0 {
833 colDef.TypeName.Typmods = &ast.List{}
834 for _, param := range n.Type.Parameters {
835 colDef.TypeName.Typmods.Items = append(colDef.TypeName.Typmods.Items, c.convertExpr(param))
836 }
837 }
838 }
839
840 // Handle PRIMARY KEY constraint
841 if n.PrimaryKey {
842 colDef.PrimaryKey = true
843 }
844
845 // Handle DEFAULT
846 if n.Default != nil {
847 // colDef.RawDefault = c.convertExpr(n.Default)
848 }
849
850 // Handle comment
851 if n.Comment != "" {
852 colDef.Comment = n.Comment
853 }
854
855 return colDef
856}
857
858func (c *cc) convertUpdateQuery(n *chast.UpdateQuery) *ast.UpdateStmt {
859 rv := &ast.RangeVar{

Callers 2

convertCreateQueryMethod · 0.95
convertAlterQueryMethod · 0.95

Calls 3

convertExprMethod · 0.95
identifierFunction · 0.70
isNotNullFunction · 0.70

Tested by

no test coverage detected