Commit Graph

11 Commits (55ad9007cd9c3c296927897a8dfeed9b5a672942)

Author SHA1 Message Date
Jack Christensen 11d351dd75 Replace Status with Valid to conform to database/sql style
https://github.com/jackc/pgx/issues/1060
2021-11-29 12:55:19 -05:00
Eli Treuherz db84905b7f Add NullDecimal to shopspring-numeric
The shopspring/decimal package provides a NullDecimal struct intended
for use with nullable SQL NUMERICs and numbers. It has Scanner and
Valuer implementations already, but adding it to this package allows
it to be used with the binary encoding as well.

The implementation is very straightforward, but the tests have been made
slightly more complicated. The previous version wasn't testing the
decimal.Decimal cases, and this change adds those as well as new
NullDecimal cases. I've added some logic to the test harness to catch
these as you need to use the Equals method to properly compare Decimals.
2021-08-07 08:23:02 -05:00
Jack Christensen c16a4f7d6a Revert "Temporarily delete tests and pgxtype to break recursive dependency with pgx"
This reverts commit 32e20a6031.
2021-07-24 10:40:30 -05:00
Jack Christensen 32e20a6031 Temporarily delete tests and pgxtype to break recursive dependency with pgx 2021-07-24 10:16:00 -05:00
Jack Christensen e6c6de9494 Improved ext/shopspring-numeric binary decoding performance
Before:
BenchmarkDecode/Zero-Binary-16       	 3944304	       292 ns/op	     128 B/op	       7 allocs/op
BenchmarkDecode/Small-Binary-16      	 2034132	       585 ns/op	     184 B/op	      13 allocs/op
BenchmarkDecode/Medium-Binary-16     	 1747191	       690 ns/op	     192 B/op	      12 allocs/op
BenchmarkDecode/Large-Binary-16      	 1334006	       899 ns/op	     304 B/op	      14 allocs/op
BenchmarkDecode/Huge-Binary-16       	  702382	      1590 ns/op	     584 B/op	      18 allocs/op

After:
BenchmarkDecode/Zero-Binary-16       	14592645	        80.1 ns/op	      64 B/op	       2 allocs/op
BenchmarkDecode/Small-Binary-16      	 5729318	       212 ns/op	     104 B/op	       7 allocs/op
BenchmarkDecode/Medium-Binary-16     	 4930009	       241 ns/op	      88 B/op	       5 allocs/op
BenchmarkDecode/Large-Binary-16      	 3369573	       344 ns/op	     144 B/op	       7 allocs/op
BenchmarkDecode/Huge-Binary-16       	 2587156	       453 ns/op	     216 B/op	       9 allocs/op
2020-05-02 11:34:14 -05:00
Jack Christensen 4ed0de4755 Splitting pgtype into own repo 2019-04-20 19:14:08 -05:00
Jack Christensen 8502a12ac7 Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00
Jack Christensen 7ed0a8732c Update shopspring decimal integration test
New version of shopspring/decimal improves precision. This broke a test.
2018-03-08 07:40:25 -05:00
Jack Christensen 071de0b674 Fix shopsprint-numeric test 2017-05-20 09:46:06 -05:00
Jack Christensen 1f1677ba5e Ensure shopspring-numeric tests run 2017-05-20 09:44:15 -05:00
Jack Christensen b49035fdc1 Add shopspring.Numeric
This adds PostgreSQL numeric mapping to and from
github.com/shopspring/decimal.

Makes pgtype.NullAssignTo public as external types need this functionality.

Begin extraction of pgtype testing functionality so it can easily be used by
external types.
2017-04-14 12:24:44 -05:00