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

Function shimOverride

internal/codegen/golang/opts/shim.go:24–55  ·  view source on GitHub ↗
(req *plugin.GenerateRequest, o *Override)

Source from the content-addressed store, hash-verified

22}
23
24func shimOverride(req *plugin.GenerateRequest, o *Override) *ShimOverride {
25 var column string
26 var table plugin.Identifier
27
28 if o.Column != "" {
29 colParts := strings.Split(o.Column, ".")
30 switch len(colParts) {
31 case 2:
32 table.Schema = req.Catalog.DefaultSchema
33 table.Name = colParts[0]
34 column = colParts[1]
35 case 3:
36 table.Schema = colParts[0]
37 table.Name = colParts[1]
38 column = colParts[2]
39 case 4:
40 table.Catalog = colParts[0]
41 table.Schema = colParts[1]
42 table.Name = colParts[2]
43 column = colParts[3]
44 }
45 }
46 return &ShimOverride{
47 DbType: o.DBType,
48 Nullable: o.Nullable,
49 Unsigned: o.Unsigned,
50 Column: o.Column,
51 ColumnName: column,
52 Table: &table,
53 GoType: shimGoType(o),
54 }
55}
56
57type ShimGoType struct {
58 ImportPath string

Callers 1

parseMethod · 0.85

Calls 1

shimGoTypeFunction · 0.85

Tested by

no test coverage detected