11 Commits

Author SHA1 Message Date
Jack Christensen
99f22ac8e4 Port DSN parser from pgx v3
Original implementation: 2d9d8dc52ac211c6191c08e050c03588aa633038 by
Joshua Barone <joshua.barone@gmail.com>.

Also changed DSN tests to use "dbname" as key rather than "database" as
that is what the PostgreSQL documentation specifies. "database" still
actually works but it should not be encouraged as it is non-standard.
2019-09-14 18:37:33 -05:00
Jack Christensen
a8362ef96d Parse postgresql:// protocol 2019-09-10 17:14:04 -05:00
Jack Christensen
e6cf51b304 Expose min_read_buffer_size config param 2019-08-25 00:22:32 -05:00
Jack Christensen
3dec184811 Split ValidateConnect from AfterConnect
This avoids the foot-gun of ParseConfig setting AfterConnect because of
target_session_attrs and the user inadvertently overriding it with an
AfterConnect designed to setup the connection.

Now target_session_attrs will be handled with ValidateConnect.
2019-07-13 10:22:09 -05:00
Jack Christensen
59941377c8 Rename Config.AfterConnectFunc to AfterConnect
No need to include the type in the name.
2019-07-13 09:52:22 -05:00
Jack Christensen
fbdfccf1f9 Use Go modules 2019-03-30 12:55:56 -05:00
Jack Christensen
c447ff4e79 Use NoError instead of Nil for assertions 2019-01-19 14:51:07 -06:00
Jack Christensen
bcc3da490c Run tests in parallel 2018-12-31 17:34:44 -06:00
Jack Christensen
8c574c39f8 Add support for libpq target_session_attrs
Generalize AcceptConnFunc into AfterConnectFunc.
2018-12-31 12:15:29 -06:00
Jack Christensen
1836f7be46 Support comma separated hosts and ports like libpq
Also add test and fix the fallback config implementation.
2018-12-31 11:14:13 -06:00
Jack Christensen
beeb69ff0b Restructure connect process
- Moved lots of connection logic to pgconn from pgx
- Extracted pgpassfile package
2018-12-30 16:55:56 -06:00