Created
October 11, 2020 10:16
-
-
Save mtsmfm/738f16a88a0104d4f40692d68f30d68e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ DATABASE_URL=postgres://postgres:password@postgres/postgres?sslmode=disable go run utils/foo.go | |
| panic: runtime error: invalid memory address or nil pointer dereference | |
| [signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x68e9dc] | |
| goroutine 1 [running]: | |
| github.com/ericlagergren/decimal.(*Big).IsNaN(...) | |
| /home/app/go/pkg/mod/github.com/ericlagergren/[email protected]/big.go:853 | |
| github.com/volatiletech/sqlboiler/v4/types.decimalValue(0x0, 0x8fe300, 0x0, 0x0, 0x7fa1a03ebca0, 0x8a9601) | |
| /home/app/go/pkg/mod/github.com/volatiletech/sqlboiler/[email protected]/types/decimal.go:140 +0x3c | |
| github.com/volatiletech/sqlboiler/v4/types.Decimal.Value(0x0, 0xc0001a15f0, 0x40d1e5, 0x6c4760, 0x7007c0) | |
| /home/app/go/pkg/mod/github.com/volatiletech/sqlboiler/[email protected]/types/decimal.go:58 +0x30 | |
| database/sql/driver.callValuerValue(0x7fa1a03ebca0, 0x0, 0x0, 0x7fa1a03ebca0, 0x0, 0x7fa1a03ebc01) | |
| /usr/local/go/src/database/sql/driver/types.go:233 +0xc5 | |
| database/sql/driver.defaultConverter.ConvertValue(0x7007c0, 0x0, 0x6b1720, 0x8b26c0, 0x0, 0x0) | |
| /usr/local/go/src/database/sql/driver/types.go:243 +0x79d | |
| database/sql.defaultCheckNamedValue(0xc0001010b8, 0x0, 0x0) | |
| /usr/local/go/src/database/sql/convert.go:97 +0x38 | |
| database/sql.driverArgsConnLocked(0x765440, 0xc0001ae000, 0x0, 0xc00000ec80, 0x2, 0x2, 0x34, 0x6fcea0, 0x40c10c, 0x8cb4a0, ...) | |
| /usr/local/go/src/database/sql/convert.go:177 +0x193 | |
| database/sql.(*DB).execDC.func2() | |
| /usr/local/go/src/database/sql/sql.go:1566 +0xee | |
| database/sql.withLock(0x763b60, 0xc00015c6c0, 0xc0001a1aa8) | |
| /usr/local/go/src/database/sql/sql.go:3284 +0x69 | |
| database/sql.(*DB).execDC(0xc00010dba0, 0x765dc0, 0xc0000160b0, 0xc00015c6c0, 0xc0001a1bd0, 0xc0000208c0, 0x33, 0xc00000ec80, 0x2, 0x2, ...) | |
| /usr/local/go/src/database/sql/sql.go:1565 +0x495 | |
| database/sql.(*DB).exec(0xc00010dba0, 0x765dc0, 0xc0000160b0, 0xc0000208c0, 0x33, 0xc00000ec80, 0x2, 0x2, 0x700701, 0xc00000ec28, ...) | |
| /usr/local/go/src/database/sql/sql.go:1550 +0x139 | |
| database/sql.(*DB).ExecContext(0xc00010dba0, 0x765dc0, 0xc0000160b0, 0xc0000208c0, 0x33, 0xc00000ec80, 0x2, 0x2, 0x2, 0x0, ...) | |
| /usr/local/go/src/database/sql/sql.go:1528 +0xe5 | |
| github.com/mtsmfm/stunning-waffle/models.(*User).Insert(0xc00000ec20, 0x765dc0, 0xc0000160b0, 0x766a80, 0xc00010dba0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) | |
| /app/server/models/users.go:489 +0x6b0 | |
| main.main() | |
| /app/server/utils/foo.go:18 +0xc5 | |
| exit status 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "database/sql" | |
| "os" | |
| _ "github.com/lib/pq" | |
| "github.com/mtsmfm/test/models" | |
| "github.com/volatiletech/sqlboiler/v4/boil" | |
| ) | |
| func main() { | |
| ctx := context.Background() | |
| db, _ := sql.Open("postgres", os.Getenv("DATABASE_URL")) | |
| user := models.User{} | |
| user.Insert(ctx, db, boil.Infer()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE IF NOT EXISTS users ( | |
| id INTEGER PRIMARY KEY, | |
| dollars NUMERIC NOT NULL | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment