gf-cli
gf-cli copied to clipboard
mssql 在遇到 NVARCHAR 类型时,会出现数组越界
gf gen model -t merchant
2020-08-31 16:22:59.041 [DEBU] [ 13 ms] SELECT c.name as FIELD, CASE t.name WHEN 'numeric' THEN t.name + '(' + convert(varchar(20),c.xprec) + ',' + convert(varchar(20),c.xscale) + ')' WHEN 'char' THEN t.name + '(' + convert(varchar(20),c.length)+ ')' WHEN 'varchar' THEN t.name + '(' + convert(varchar(20),c.length)+ ')' ELSE t.name + '(' + convert(varchar(20),c.length)+ ')' END as TYPE FROM systypes t,syscolumns c WHERE t.xtype=c.xtype AND c.id = (SELECT id FROM sysobjects WHERE name='MERCHANT') ORDER BY c.colid
panic: runtime error: index out of range [12] with length 11
goroutine 1 [running]:
github.com/gogf/gf-cli/commands/gen.generateStructDefinition(0xc0002bbdd0, 0x8, 0x1)
/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf-cli/commands/gen/gen_model.go:186 +0x427
github.com/gogf/gf-cli/commands/gen.generateModelContentFile(0xdd8000, 0xc000338090, 0xc00001e0d0, 0x8,
0xc00001e0d0, 0x8, 0xbb1c48, 0xb, 0xbad546, 0x7)
/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf-cli/commands/gen/gen_model.go:107 +0xf0
github.com/gogf/gf-cli/commands/gen.doGenModel(0xc00004c180)
/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf-cli/commands/gen/gen_model.go:88 +0x54a
github.com/gogf/gf-cli/commands/gen.Run()
/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf-cli/commands/gen/gen.go:62 +0x34b
main.main()
/Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf-cli/main.go:90 +0x50b
@sanrentai 我这没有mssql
环境,能否提供PR帮助gf-cli
修改?