Commit Graph

91 Commits (c844a2402bef2bff7616a8cf15c1a6b602a22ec2)

Author SHA1 Message Date
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 8e9b095ce0
Merge pull request #410 from jbowens/acquireconn
stdlib: allow nested database/sql/driver.Drivers
2018-04-14 10:33:26 -04: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
Jackson Owens 14f1f2aa01 stdlib: allow nested database/sql/driver.Drivers
database/sql/driver.Driver implementations can be nested, with each
layer adding additional functionality. If pgx/stdlib.Driver is wrapped
in another driver.Driver implementation, AcquireConn will error,
detecting that the *sql.DB's driver is not (directly) pgx.Driver.

It looks like it should be possible to support the current functionality
without requiring that the top-level Driver be pgx/stdlib.Driver, but
it requires using a global map of fakeTxConns instead of a per-Driver
map of fakeTxConns.

Is this reasonable?
2018-04-11 19:31:33 -07: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
Nick Jones e86386c8d2
Fix docs in stdlib. 2017-12-07 16:28:54 +11:00
Jack Christensen 546a1e8ecf Document parameter notation in stdlib docs
refs #351
2017-11-17 09:37:57 -06: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 8f4178b3d3 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen 8712627257 Use Go casing convention for CID/TID/XID/CIDR 2017-06-03 12:01:49 -05:00
Jack Christensen 27ab289096 Use Go casing convention for OID 2017-06-03 11:53:49 -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 8a7165dd98 Add ctx to PrepareEx
Remove PrepareExContext
2017-05-20 18:03:59 -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 4f31904904 Remove spurious Println 2017-05-19 15:52:18 -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
Jack Christensen 7b1f461ec3 Add simple protocol suuport with (Query|Exec)Ex 2017-04-10 08:58:51 -05:00
James Lawrence c5d247830c enable sql.Open to support both DSN and URI based connection strings 2017-04-01 08:50:48 -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 bec9bd261b Add database/sql support to pgtype 2017-03-18 21:11:43 -05:00
Jack Christensen 9ab59a74a9 Remove oid constants from pgx 2017-03-18 14:59:34 -05:00
Jack Christensen ba5f97176a Move not null Oid to pgtype
In preparation to ConnInfo implementation.
2017-03-13 21:34:38 -05:00
Jack Christensen 743b98b298 Name PG types as words
Though this doesn't follow Go naming conventions exactly it makes names more
consistent with PostgreSQL and it is easier to read. For example, TIDOID becomes
TidOid. In addition this is one less breaking change in the move to V3.
2017-03-11 17:03:23 -06:00
Jack Christensen 0a0c086edd Fix broken stdlib tests 2017-03-03 16:46:50 -06: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 7fbff4a495 Merge branch 'context' into v3-experimental 2017-02-12 15:13:47 -06:00
Jack Christensen cc414269c1 Remove debugging Println 2017-02-12 08:12:36 -06:00
Jack Christensen 351eb8ba67 Initial proof-of-concept database/sql context support 2017-02-06 19:39:34 -06:00