5 Commits

Author SHA1 Message Date
Maxim Ivanov
5f0d5f4255 Remove pgtype.Row(), introduce Composite.Scan()
pgtype.Row() was optimized for a single line use
without much ceremony at a cost of OID registration,
which is cumbersome. In practice it so much incovnenience
to create new Composite just before making a query.

So now there is just a Composite type and 2 helper methods:

- SetFields sets composite fields to values passed. This assignment
  fails if types passed are not assignable to Values pgtype is
  made of.

- Scan acts exactly like query.Scan, but for a composite value. Passed
  values are set to values from SQL composite.
2020-04-27 00:48:02 +01:00
Maxim Ivanov
e283f322e1 Composite().Row() helper for working with composites without registration 2020-04-20 22:38:20 +00:00
Maxim Ivanov
04ff904ff5 Add binary decoding benchmarks
```
BenchmarkBinaryDecodingManual-4         10479085               106 ns/op              40 B/op          2 allocs/op
BenchmarkBinaryDecodingHelpers-4         4485451               263 ns/op              64 B/op          4 allocs/op
BenchmarkBinaryDecodingRow-4             1999726               587 ns/op              96 B/op          5 allocs/op
```
2020-04-19 15:46:14 +00:00
Maxim Ivanov
72680d61f8 Move value createion outside of encoding benchmark 2020-04-19 11:30:21 +00:00
Maxim Ivanov
54a03cb143 Add benchmark for various composite encoder implementations
```
BenchmarkBinaryEncodingManual-12   824053234   28.9 ns/op    0 B/op     0 allocs/op
BenchmarkBinaryEncodingHelper-12   76815436    314 ns/op     192 B/op   5 allocs/op
BenchmarkBinaryEncodingRow-12      65302958    364 ns/op     192 B/op   5 allocs/op
```
2020-04-16 22:24:43 +01:00