Skip to content

Commit d710427

Browse files
committed
remove unnecessary function
1 parent 447fb03 commit d710427

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

internal/codegen/golang/postgresql_type.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,14 @@
11
package golang
22

33
import (
4-
"fmt"
54
"log"
6-
"strings"
75

86
"github.com/sqlc-dev/sqlc/internal/codegen/golang/opts"
97
"github.com/sqlc-dev/sqlc/internal/codegen/sdk"
108
"github.com/sqlc-dev/sqlc/internal/debug"
119
"github.com/sqlc-dev/sqlc/internal/plugin"
1210
)
1311

14-
func parseIdentifierString(name string) (*plugin.Identifier, error) {
15-
parts := strings.Split(name, ".")
16-
switch len(parts) {
17-
case 1:
18-
return &plugin.Identifier{
19-
Name: parts[0],
20-
}, nil
21-
case 2:
22-
return &plugin.Identifier{
23-
Schema: parts[0],
24-
Name: parts[1],
25-
}, nil
26-
case 3:
27-
return &plugin.Identifier{
28-
Catalog: parts[0],
29-
Schema: parts[1],
30-
Name: parts[2],
31-
}, nil
32-
default:
33-
return nil, fmt.Errorf("invalid name: %s", name)
34-
}
35-
}
36-
3712
func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.Column) string {
3813
columnType := sdk.DataType(col.Type)
3914
notNull := col.NotNull || col.IsArray
@@ -555,11 +530,7 @@ func postgresType(req *plugin.GenerateRequest, options *opts.Options, col *plugi
555530
return "interface{}"
556531

557532
default:
558-
rel, err := parseIdentifierString(columnType)
559-
if err != nil {
560-
// TODO: Should this actually return an error here?
561-
return "interface{}"
562-
}
533+
rel := col.Type
563534
if rel.Schema == "" {
564535
rel.Schema = req.Catalog.DefaultSchema
565536
}

0 commit comments

Comments
 (0)