32 Commits

Author SHA1 Message Date
Skip Gibson
81b6ad72f6 config: fix ValidateConnect comment 2019-10-16 10:01:16 +01:00
Jack Christensen
3f377acc1e
Merge pull request #14 from furdarius/resolve-hostnames-into-addrs
Validate all addresses resolved from hostname
2019-09-20 08:51:22 -05:00
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
Artemiy Ryabinkov
b2ca5d8f52
validate all addresses resolved from hostname
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
2019-09-13 17:26:09 +03:00
Jack Christensen
a8362ef96d Parse postgresql:// protocol 2019-09-10 17:14:04 -05:00
Jack Christensen
2fabfa3c18 Update to newest pgproto3 2019-08-31 15:44:54 -05:00
Jack Christensen
138254da5b Refactor errors
- Use strongly typed errors internally
- SafeToRetry(error) streamlines retry logic over ErrNoBytesSent
- Timeout(error) removes the need to choose between returning a context
  and an i/o error
2019-08-27 18:05:50 -05:00
Jack Christensen
e6cf51b304 Expose min_read_buffer_size config param 2019-08-25 00:22:32 -05:00
Jack Christensen
595d09d6f1 Build fully operational Frontend 2019-08-24 23:57:24 -05:00
Jack Christensen
797a44bf04 Rename BuildFrontendFunc to BuildFrontend
For consistency with other functions supplied in Config.
2019-08-24 16:18:04 -05:00
Jack Christensen
760dd75542 Require Config to be created by ParseConfig 2019-08-24 09:28:44 -05:00
Artemiy Ryabinkov
0a99b543c0
Add BuildFrontendFunc in Config
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
2019-08-08 11:46:25 +03:00
Artemiy Ryabinkov
fa7e06489b
Add MinReadBufferSize option to Config
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
2019-07-26 11:14:07 +03: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
d2440c7fe6 Improve documentation 2019-06-22 16:54:10 -05:00
Jack Christensen
cd629965e6 Use golang.org/x/xerrors 2019-04-20 12:57:52 -05:00
Jack Christensen
444bd6deaf Context cancellation is fatal during query 2019-03-30 16:44:20 -05:00
Jack Christensen
fbdfccf1f9 Use Go modules 2019-03-30 12:55:56 -05:00
Jack Christensen
cd4b0025c3 Add listen/notify to pgconn 2019-01-14 20:39:10 -06:00
Jack Christensen
bd777fe20c Add custom context cancellation hook 2019-01-12 11:37:13 -06:00
Jack Christensen
406e95650a Add more docs 2019-01-05 18:40:33 -06:00
Jack Christensen
2c8971b382 Rename some types and methods 2019-01-05 18:01:57 -06:00
Jack Christensen
cddf011806 Big restructure to better handle context cancel 2019-01-05 17:37:28 -06:00
Jack Christensen
460946d662 Move notice handling to pgconn 2019-01-02 13:15:26 -06:00
Jack Christensen
4ee6fef452 Add context to potentially blocking methods 2018-12-31 17:17:11 -06:00
Jack Christensen
4e12c08b04 Use buffered exec 2018-12-31 14:14:40 -06:00
Jack Christensen
b419493e5c Add pgconn.Exec 2018-12-31 13:32:26 -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
5ae6310b05 Add AcceptConnFunc for filtering HA connections 2018-12-31 11:39:22 -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