Jack Christensen
858d00788a
Use extracted packages with Go modules
2019-04-05 10:59:47 -05:00
James Hartig
6d336eccb1
Added LastStmtSent and use it to retry on errors if statement was not sent
...
Previously, a failed connection could be put back in a pool and when the
next query was attempted it would fail immediately trying to prepare the
query or reset the deadline. It wasn't clear if the Query or Exec call
could safely be retried since there was no way to know where it failed.
You can now call LastQuerySent and if it returns false then you're
guaranteed that the last call to Query(Ex)/Exec(Ex) didn't get far enough
to attempt to send the query. The call can be retried with a new
connection.
This is used in the stdlib to return a ErrBadConn if a network error
occurred and the statement was not attempted.
Fixes #427
2018-11-19 10:44:40 -05:00
Jack Christensen
897e90f353
Type modifier should be int32 not uint32
2018-09-22 07:43:18 -05:00
Valery Krivchikov
c844a2402b
Call context.WithTimeout cancel function
2018-09-15 13:23:09 +03:00
Jack Christensen
0a483bad9d
Merge branch 'implement-opendb' of https://github.com/james-lawrence/pgx into james-lawrence-implement-opendb
2018-07-14 09:57:49 -05:00
Jack Christensen
1fbd6977e1
Use json instead of jsonb for PG 9.3 compat.
2018-04-14 10:02:08 -05:00
Jack Christensen
5297846239
pgtype.JSON(B).Value now returns []byte
...
Allows scanning jsonb column into *json.RawMessage.
fixes #409
2018-04-14 09:17:56 -05:00
James Lawrence
19a9154d23
implement driver.Connector
2018-04-08 11:12:15 -04:00
Jack Christensen
3707b79782
Add prefer simple protocol support to stdlib
...
Test code partially taken from james-lawrence
(7471e7f9eb
)
2018-01-13 13:46:20 -06:00
ferhat elmas
763deea17e
Run gofmt with simplify flag
2017-12-21 23:45:26 +01:00
Timothée Peignier
0f84f73c7b
Add more ColumnType support
2017-08-18 18:22:08 -07:00
Jack Christensen
a147e0f3b8
Fix test on Travis
2017-07-22 08:41:13 -05:00
Jack Christensen
dfe250c13b
Allow either error message
2017-06-02 08:38:27 -05:00
Jack Christensen
07c5b76a24
Allow for either of 2 possible errors from tx context cancelation
2017-05-29 11:39:06 -05:00
Jack Christensen
21d2ed0934
Add mock close
2017-05-22 08:51:23 -05:00
Jack Christensen
d1fd222ca5
Add transaction context support
2017-05-20 17:58:19 -05:00
Jack Christensen
2a27fb1817
Remove accidentally committed mock db open
2017-05-20 08:30:47 -05:00
Jack Christensen
e5820baebe
Add driver.StmtQueryContext support to stdlib.Stmt
2017-05-19 17:31:56 -05:00
Jack Christensen
7f226539a0
Add driver.StmtExecContext support to stdlib.Stmt
2017-05-19 16:18:54 -05:00
Jack Christensen
f9cb22e4b8
Add driver.RowsColumnTypeDatabaseTypeName support to stdlib.Rows
2017-05-19 16:05:30 -05:00
Jack Christensen
5ee76a26c8
Add tests for stdlib.Conn.QueryContext
2017-05-19 15:54:55 -05:00
Jack Christensen
dbcfa46d8e
Add driver.ExecerContext support to stdlib.Conn
2017-05-19 14:57:49 -05:00
Jack Christensen
f8d7602270
Add driver.ConnPrepareContext support to stdlib.Conn
2017-05-19 14:31:01 -05:00
Jack Christensen
936cb68866
Add driver.Pinger support to stdlib.Conn
2017-05-19 08:54:08 -05:00
Jack Christensen
479ebdfa19
Add basic pgmock support
...
Primarily useful for testing pgx itself. Design is still subject to change.
2017-05-13 17:56:54 -05:00
Jack Christensen
6a2a5e28fd
Fix issues identified by go vet
2017-05-06 19:48:03 -05:00
Jack Christensen
c78d450c19
Add stdlib AcquireConn and ReleaseConn
...
Also add some documentation.
2017-05-06 19:39:40 -05:00
Jack Christensen
4cbefbb27e
Add TxOptions support to stdlib
2017-05-06 16:29:37 -05:00
Jack Christensen
ffae1b1345
Remove stdlib.OpenFromConnPool
2017-05-06 15:39:26 -05:00
Jack Christensen
78d344d1ab
Add DriverConfig system to stdlib
2017-05-06 15:28:16 -05:00
Jack Christensen
280bce7078
Added log adapter for logrus
...
Also changed standard logger interface to take a map instead of varargs for
extra data.
2017-04-29 21:28:38 -05:00
Jack Christensen
855b735eae
Add log adapters for testing and log15
...
Make LogLevel a type for Stringer interface.
2017-04-29 20:33:52 -05:00
Terin Stock
1a99c0e5c4
fix(stdlib): lock openFromConnPoolCount while using
...
Locks the `openFromConnPoolCount` counter while formatting the driver
name and incrementing to avoid a data race of multiple goroutines
modifying the counter and registering the same name. `sql.Register`
panics if a driver name has already been registered.
2017-03-22 08:16:09 -05:00
Jack Christensen
ed9e8bb168
Remove skip test for missing json type
...
All supported versions of PostgreSQL now have json type.
2017-03-03 16:08:00 -06:00
Jack Christensen
ecedf3d94a
Fix stdlib test logger
2017-01-07 10:16:12 -06:00
Kris Wehner
edbd30ea6a
Add replication stop mechanism
2016-12-06 15:44:37 -08:00
Jack Christensen
a8a990f51b
Add test for stdlib query not being logged properly
2016-07-07 07:50:34 -05:00
Jack Christensen
b5901f7dba
Fix skip JSON tests for old servers
2015-11-12 15:43:48 -06:00
Jack Christensen
09e0cc4815
Skip JSON tests for old PostgreSQL servers
2015-11-12 15:27:20 -06:00
Jack Christensen
e1215d9b19
[]byte skips encoding/decoding
...
refs #104
2015-11-12 14:54:25 -06:00
Jack Christensen
26bb780063
inet is known type now -- so use point instead
2015-11-12 13:41:00 -06:00
Jack Christensen
69102e4463
test ipv4 for travis simplicity
2015-10-26 19:08:15 -05:00
Jack Christensen
db57394741
test ipv4 for travis simplicity
2015-10-26 18:13:35 -05:00
Jack Christensen
acdf5acc5a
Add test for stdlib query nil
2015-04-15 08:01:26 -05:00
Jack Christensen
d5e170cc0f
Add stdlib test for []byte
2014-10-03 14:52:33 -05:00
Jack Christensen
e29574d447
Add support for integer, float and text arrays
...
Restructure internals a bit so pgx/stdlib can turn off binary encoding and
receive text back for array types.
2014-07-26 15:03:52 -05:00
Jack Christensen
3761c6335e
Ensure db is valid at end of tests
2014-07-19 17:52:36 -05:00
Jack Christensen
3144b5363f
Support unknown PostgreSQL types as strings
2014-07-19 17:49:11 -05:00
Jack Christensen
bdb5387646
Fix Open with OpenFromConnPool
2014-06-21 17:33:30 -05:00
Jack Christensen
ca9128c3b1
Add test for invalid query
2014-06-21 11:39:28 -05:00
Jack Christensen
09b9964ca7
Add OpenFromConnPool
2014-06-21 11:34:56 -05:00
Jack Christensen
eb85aad21f
Conn implements driver.Execer and driver.Queryer
2014-06-21 10:06:45 -05:00
Jack Christensen
b2c1a14fcc
Update github.com/JackC to github.com/jackc
2014-06-21 08:36:20 -05:00
Jack Christensen
6c7f173b08
DRY pgx/stdlib tests
2014-06-20 14:09:31 -05:00
Jack Christensen
c0e8563b8c
Add initial database/sql support
2014-06-20 14:05:16 -05:00