Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions internal/compiler/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ func stringSlice(list *ast.List) []string {
for _, item := range list.Items {
if n, ok := item.(*ast.String); ok {
items = append(items, n.Str)
continue
}
if n, ok := item.(*ast.String); ok {
items = append(items, n.Str)
continue
}
}
return items
Expand Down
12 changes: 3 additions & 9 deletions internal/compiler/to_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ import (
"github.com/sqlc-dev/sqlc/internal/sql/astutils"
)

func isArray(n *ast.TypeName) bool {
if n == nil || n.ArrayBounds == nil {
return false
}
return len(n.ArrayBounds.Items) > 0
}

func arrayDims(n *ast.TypeName) int {
if n == nil || n.ArrayBounds == nil {
return 0
Expand All @@ -29,11 +22,12 @@ func toColumn(n *ast.TypeName) *Column {
if err != nil {
panic("toColumn: " + err.Error())
}
arrayDims := arrayDims(n)
return &Column{
Type: typ,
DataType: strings.TrimPrefix(astutils.Join(n.Names, "."), "."),
NotNull: true, // XXX: How do we know if this should be null?
IsArray: isArray(n),
ArrayDims: arrayDims(n),
IsArray: arrayDims > 0,
ArrayDims: arrayDims,
}
}