Commit Graph

17 Commits (ccb207cba5b4dd520b9cc40994eeb161ce140737)

Author SHA1 Message Date
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 ee0e207ee4 CompositeType fields contain name and oid 2020-05-13 07:09:52 -05:00
Jack Christensen fcb385dccb Add ScanDecoder and ScanValue to composite scanners.
Rename Scan to Next to disambiguate.
2020-05-12 15:04:14 -05:00
Jack Christensen e51cb1ef09 Add CompositeBinaryBuilder 2020-05-12 14:04:11 -05:00
Jack Christensen 9cdd928cb8 CompositeType implements TypeValue 2020-05-12 10:40:13 -05:00
Jack Christensen bff2829b0f Move ComposteType.Scan functionality into AssignTo
Also remove adapter functions that are no longer used.
2020-05-12 10:19:41 -05:00
Jack Christensen 247043b597 Merge SetFields functionality into Set 2020-05-12 08:35:45 -05:00
Jack Christensen 4a6bd41a36 Rename Composite to CompositeType.
This harmonizes the naming with EnumType and ArrayType.
2020-05-12 07:58:10 -05:00
Jack Christensen 452511dfc5 Rename RecordFieldIter to CompositeBinaryScanner and adjust interface
Use interface similar to bufio.Scanner and pgx.Rows.
2020-05-07 13:38:19 -05:00
Jack Christensen ff9bc5d68d Merge binary package into pgtype package 2020-05-07 10:15:23 -05:00
Maxim Ivanov 63c5d350a3 Add JSON benchmarks 2020-05-02 10:54:19 +01:00
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