Closed d-fal closed 5 years ago
Thanks for this nice piece of work. I want to query a row by go-pg rom. It gives back the following panic
`panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8fd469]
goroutine 1 [running]: github.com/go-pg/pg/orm.(Field).ScanValue(0xc0000c50e0, 0xa97ae0, 0xc0001bb200, 0x199, 0xb6f400, 0xc00012c0e0, 0x12, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/orm/field.go:86 +0xb9 github.com/go-pg/pg/orm.(structTableModel).scanColumn(0xc0002be0b0, 0x6, 0xc000249788, 0x3, 0xb6f400, 0xc00012c0e0, 0x12, 0xc000193aa8, 0x950f78, 0xc00012c0e0) /home/davood/go/src/github.com/go-pg/pg/orm/model_table_struct.go:261 +0x14e github.com/go-pg/pg/orm.(structTableModel).ScanColumn(0xc0002be0b0, 0x6, 0xc000249788, 0x3, 0xb6f400, 0xc00012c0e0, 0x12, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/orm/model_table_struct.go:219 +0x8e github.com/go-pg/pg.readDataRow(0xc00012c0e0, 0xb698a0, 0xc0002be0b0, 0xc000081b00, 0xf, 0x10, 0x10, 0x0) /home/davood/go/src/github.com/go-pg/pg/messages.go:760 +0x149 github.com/go-pg/pg.readSimpleQueryData(0xc00012c0e0, 0xa9cbc0, 0xc0002be0b0, 0x0, 0x93c480, 0xbefa5d71b665a1f1) /home/davood/go/src/github.com/go-pg/pg/messages.go:813 +0x260 github.com/go-pg/pg.(DB).simpleQueryData.func2(0xc00012c0e0, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/db.go:511 +0x53 github.com/go-pg/pg/internal/pool.(Conn).WithReader(0xc0001e2f00, 0x0, 0xc000193ca8, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/internal/pool/conn.go:90 +0x4c github.com/go-pg/pg.(DB).simpleQueryData(0xc00026bef0, 0xc0001e2f00, 0xa9cbc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0xc00009f530, 0x1, 0x1, 0x96e4a0, ...) /home/davood/go/src/github.com/go-pg/pg/db.go:510 +0x187 github.com/go-pg/pg.(DB).Query(0xc00026bef0, 0xa9cbc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0xc00009f530, 0x1, 0x1, 0xc000193e88, 0x40ad9f, ...) /home/davood/go/src/github.com/go-pg/pg/db.go:257 +0x170 github.com/go-pg/pg/orm.(Query).query(0xc000224900, 0xb6fdc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0x0, 0x0, 0x0, 0xb70340) /home/davood/go/src/github.com/go-pg/pg/orm/query.go:676 +0x250 github.com/go-pg/pg/orm.(*Query).Select(0xc000224900, 0x0, 0x0, 0x0, 0xc000224900, 0xa41e80)`
My User struct is something like this:
`package model
import "github.com/paulmach/orb"
type Users struct { Id FirstName string MiddleName string LastName string UserName string sql:",notnull, unique" Password string sql:",notnull" Loc orb.Point sql:",type:Point" } `Would you pls help how should I figure it out?
sql:",notnull, unique"
sql:",notnull"
sql:",type:Point"
I don't know anything about go-pg/orm but I'd try doing Loc *orb.Point and see if that works.
Loc *orb.Point
Thanks for this nice piece of work. I want to query a row by go-pg rom. It gives back the following panic
`panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8fd469]
goroutine 1 [running]: github.com/go-pg/pg/orm.(Field).ScanValue(0xc0000c50e0, 0xa97ae0, 0xc0001bb200, 0x199, 0xb6f400, 0xc00012c0e0, 0x12, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/orm/field.go:86 +0xb9 github.com/go-pg/pg/orm.(structTableModel).scanColumn(0xc0002be0b0, 0x6, 0xc000249788, 0x3, 0xb6f400, 0xc00012c0e0, 0x12, 0xc000193aa8, 0x950f78, 0xc00012c0e0) /home/davood/go/src/github.com/go-pg/pg/orm/model_table_struct.go:261 +0x14e github.com/go-pg/pg/orm.(structTableModel).ScanColumn(0xc0002be0b0, 0x6, 0xc000249788, 0x3, 0xb6f400, 0xc00012c0e0, 0x12, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/orm/model_table_struct.go:219 +0x8e github.com/go-pg/pg.readDataRow(0xc00012c0e0, 0xb698a0, 0xc0002be0b0, 0xc000081b00, 0xf, 0x10, 0x10, 0x0) /home/davood/go/src/github.com/go-pg/pg/messages.go:760 +0x149 github.com/go-pg/pg.readSimpleQueryData(0xc00012c0e0, 0xa9cbc0, 0xc0002be0b0, 0x0, 0x93c480, 0xbefa5d71b665a1f1) /home/davood/go/src/github.com/go-pg/pg/messages.go:813 +0x260 github.com/go-pg/pg.(DB).simpleQueryData.func2(0xc00012c0e0, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/db.go:511 +0x53 github.com/go-pg/pg/internal/pool.(Conn).WithReader(0xc0001e2f00, 0x0, 0xc000193ca8, 0x0, 0x0) /home/davood/go/src/github.com/go-pg/pg/internal/pool/conn.go:90 +0x4c github.com/go-pg/pg.(DB).simpleQueryData(0xc00026bef0, 0xc0001e2f00, 0xa9cbc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0xc00009f530, 0x1, 0x1, 0x96e4a0, ...) /home/davood/go/src/github.com/go-pg/pg/db.go:510 +0x187 github.com/go-pg/pg.(DB).Query(0xc00026bef0, 0xa9cbc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0xc00009f530, 0x1, 0x1, 0xc000193e88, 0x40ad9f, ...) /home/davood/go/src/github.com/go-pg/pg/db.go:257 +0x170 github.com/go-pg/pg/orm.(Query).query(0xc000224900, 0xb6fdc0, 0xc0002be0b0, 0xa47fa0, 0xc000269ca0, 0x0, 0x0, 0x0, 0xb70340) /home/davood/go/src/github.com/go-pg/pg/orm/query.go:676 +0x250 github.com/go-pg/pg/orm.(*Query).Select(0xc000224900, 0x0, 0x0, 0x0, 0xc000224900, 0xa41e80)`
My User struct is something like this:
`package model
import "github.com/paulmach/orb"
type Users struct { Id FirstName string MiddleName string LastName string UserName string
sql:",notnull, unique"
Password stringsql:",notnull"
Loc orb.Pointsql:",type:Point"
} `Would you pls help how should I figure it out?