Ryan Leckey
4a98a51a19
Merge remote-tracking branch 'utter-step/time-rs'
2020-03-21 01:25:00 -07:00
Ryan Leckey
05d8ac2747
Finish up JSON/JSONB support for Postgres
...
* implement for &serde_json::RawValue
* sqlx::types::Json<T> is a common type that all JSON-compatible databases can implement for,
postgres implements Json<T> as JSONB
* sqlx::postgres::types::PgJson<T> resolves to JSON
* sqlx::postgres::types::PgJsonB<T> resolves to JSONB
2020-03-21 01:16:34 -07:00
Oliver Bøving
b7e53e885a
First draft of JSON/JSONB support for postgres
...
This introduces two new wrapper types `Json` and `Jsonb`, currently
exported by `sqlx::postgres::{Json, Jsonb}` and adds serde and
serde_json as optional dependencies, under the feature flag `json`.
Wrapping types in `Json[b]` that implement `serde::Deserialize` and
`serde::Serialize` allows them to be decoded and encoded respectivly.
2020-03-20 23:59:25 -07:00
Daniel Akhterov
cbdc1bbfb2
Refactor the error to be generic over database
2020-03-20 23:51:45 -07:00
Ryan Leckey
f86f80d8b9
mysql: ping now follows the normal stream lifecycle
...
fixes test introduced by #142
Co-authored-by: Daniel Akhterov <daniel@launchbadge.com>
2020-03-20 20:47:30 -07:00
Ryan Leckey
ec27b65b26
postgres: change types in macros
...
Co-authored-by: Oliver Bøving <oliverboving@gmail.com>
2020-03-20 20:07:52 -07:00
Ryan Leckey
e42a995fd9
Extract a PgSequenceDecoder from ArrayDecoder and RecordDecoder and improve to support mutual nesting
2020-03-20 19:56:25 -07:00
Ryan Leckey
13997ce957
Change HasSqlType to Type
2020-03-20 19:55:47 -07:00
Ryan Leckey
9973fa6357
Add decode_err! to help with formatted decode error generation
2020-03-20 19:55:00 -07:00
Ryan Leckey
24d62dd464
Add DecodeOwned to help with trait bounds on owned data
2020-03-20 19:54:44 -07:00
Ryan Leckey
f562e919b7
Merge branch '1d-array-pg-support' of https://github.com/oeb25/sqlx into oeb25-1d-array-pg-support
2020-03-20 10:11:02 -07:00
Ryan Leckey
50c3e5fefb
Merge pull request #138 from PoiScript/master
...
postgres: ipnetwork support
2020-03-20 09:54:43 -07:00
Ryan Leckey
a017150890
postgres: tls: accept invalid certificates and mismatched hostnames under "prefer"
2020-03-20 09:47:18 -07:00
PoiScript
fbbae16a74
update decoding and encoding
2020-03-20 11:10:36 +08:00
PoiScript
3014ab4750
fix typo in Cargo.toml
2020-03-20 10:51:47 +08:00
PoiScript
7ab76ba84e
make inet and cidr compatible
2020-03-20 10:19:14 +08:00
PoiScript
c9cca27e65
rename feature gate to ipnetwork
2020-03-20 10:19:14 +08:00
PoiScript
060c5d2b66
postgres: ipnetwork support
2020-03-19 18:21:09 +08:00
Ryan Leckey
9be1512833
mysql: use double literals in test
2020-03-18 23:16:56 -07:00
Ryan Leckey
2a8906d1e5
add more documentation
2020-03-18 22:46:44 -07:00
Ryan Leckey
1fc18460b0
transaction: document, test, and fix operation of nested transactions
2020-03-18 22:46:44 -07:00
Ryan Leckey
829f37793a
Re-export PgRecordEncoder and PgRecordDecoder
2020-03-18 22:11:02 -07:00
Ryan Leckey
5809f8687c
Merge remote-tracking branch 'origin/ab/bigdecimal'
2020-03-18 22:09:27 -07:00
Ryan Leckey
dfb313f0c6
Add Postgres <-> Rust type documentation
2020-03-18 22:08:32 -07:00
Ryan Leckey
cb67ed0300
Make PgTypeInfo::oid doc(hidden)
2020-03-18 22:08:18 -07:00
Austin Bonander
33677e86a8
move PgNumeric[Sign], PgRecord[Encoder,Decoder] to hidden postgres::types::raw
...
fix errors
2020-03-18 19:36:54 -07:00
Austin Bonander
7ffec2fef8
remove .expect()
in impl TryFrom<PgNumeric> for BigDecimal
2020-03-18 19:12:14 -07:00
Austin Bonander
979c5cc944
remove unnecessary comment and update Cargo.lock
2020-03-18 19:09:10 -07:00
Austin Bonander
3a43e939e3
refactor PgNumeric
so NaN can't be misinterpreted, document types
2020-03-18 19:06:14 -07:00
Austin Bonander
b7aabaa0ec
numeric/bigdecimal modules: fix warnings
2020-03-18 19:06:14 -07:00
Austin Bonander
3cb42def3b
macros: add support for Postgres + BigDecimal
2020-03-18 19:06:14 -07:00
Austin Bonander
94c40b3eb7
Postgres: implement numeric and BigDecimal support
2020-03-18 19:06:14 -07:00
Ryan Leckey
06be59f7f0
Remove MaybeOwned
2020-03-18 17:08:44 -07:00
Ryan Leckey
d1af2fe1b0
Prepare v0.3.0-alpha.1
2020-03-18 16:58:42 -07:00
Ryan Leckey
9d9d2bbfd4
Update dependencies
2020-03-18 16:56:24 -07:00
Ryan Leckey
6f4c478fb7
sqlite: fix NULL handling
2020-03-18 16:52:27 -07:00
Ryan Leckey
2f78ce094c
mysql: use correct default port
2020-03-17 22:02:01 -07:00
Ryan Leckey
d380f4b4a8
remove is_null_type and use Option<TypeInfo>
2020-03-17 21:43:41 -07:00
Ryan Leckey
927e2b1586
describe: fix Debug of Column
2020-03-17 21:34:12 -07:00
Ryan Leckey
b04f2cbd4d
sqlite: fix detection of INT and CHAR types
2020-03-17 21:34:01 -07:00
Austin Bonander
6cea7e2c1b
macros: add proper test for sqlite using database file
2020-03-17 21:10:19 -07:00
Austin Bonander
8328e07c97
macros + sqlite: fix error for null-typed columns
2020-03-17 21:10:19 -07:00
Ryan Leckey
2a76123bc3
Merge pull request #134 from launchbadge/derives
...
Add derives to support custom types
2020-03-17 20:04:19 -07:00
Ryan Leckey
21059620dc
mysql: support understanding ENUM as TEXT
2020-03-17 19:26:31 -07:00
Ryan Leckey
c1e6b2045c
postgres: support null in a record
2020-03-17 19:26:15 -07:00
Brian Misiak
459828ee3d
postgres: remove IntervalStyle to fix #130
...
Support more server versions, including CockroachDB, which only supports the `postgres` style.
2020-03-17 17:55:27 -07:00
Ryan Leckey
100602187f
memo: add more documentation to the database module
2020-03-17 16:33:44 -07:00
Ryan Leckey
602e61ab27
postgres: add support for decoding anonymous tuples and more fully test encoding/decoding records
2020-03-17 02:47:37 -07:00
Ryan Leckey
4e7b1b51e0
sqlite: handle encoding nulls
2020-03-17 01:13:32 -07:00
Ryan Leckey
a5d17eab00
add derive(Debug) for PgValue
2020-03-17 01:13:15 -07:00
Ryan Leckey
ced6713f57
add trailing newline
2020-03-17 01:11:15 -07:00
Tom Dohrmann
8841f83e68
removed unused imports
2020-03-16 22:58:31 -07:00
Tom Dohrmann
4cd179d42b
move decode_struct_field and encode_struct_field to sqlx-core
2020-03-16 22:58:31 -07:00
Tom Dohrmann
c3aeb275c2
add derive macros for weak & strong enums and structs
2020-03-16 22:58:25 -07:00
Ryan Leckey
ada57fa566
postgres depends on Sink from futures
2020-03-16 22:55:25 -07:00
Ryan Leckey
e0ca521889
cursor: for now, add #[doc(hidden)] to from_connection and from_pool as we look for ways to remove them
2020-03-16 22:51:55 -07:00
Ryan Leckey
d8f3953d9d
depend on std feature in futures-channel
2020-03-16 20:32:36 -07:00
Ryan Leckey
4869f48f84
sqlite: don't leak on connection failure
2020-03-16 20:30:28 -07:00
Ryan Leckey
48714e8ea9
Remove unused import in postgres/listen.rs
2020-03-16 20:00:36 -07:00
Ryan Leckey
0e3eb7ce39
postgres: listen: go back to Vec<String> for channels
2020-03-16 19:54:38 -07:00
Ryan Leckey
57d414f15c
sqlite: fix impl of DatabaseError
2020-03-16 19:54:24 -07:00
Ryan Leckey
e99e80cf94
listen: merge PgListener and PgPoolListener; allow PgListener to be used as an Executor; allow channels to be adjusted at run-time
2020-03-16 18:35:37 -07:00
Ryan Leckey
ed9d6c3b62
pool: handle reconnects during "boot"
2020-03-16 18:34:09 -07:00
Ryan Leckey
f677748a3b
postgres: Add lifetime to NotificationResponse
2020-03-16 18:31:09 -07:00
Ryan Leckey
b80080a95b
postgres: Stream::read -> Stream::receive and extract "just reading" to Stream::read
2020-03-16 18:30:45 -07:00
Ryan Leckey
0ecacfaf1d
io: forward lifetime properly in Buf trait
2020-03-16 18:29:54 -07:00
Ryan Leckey
1d0100b35d
Add DatabaseError::code
2020-03-16 18:29:41 -07:00
Ryan Leckey
5cb0d9d9cc
connection: remove unused import for MaybeOwned
2020-03-16 18:27:22 -07:00
Ryan Leckey
12e250b52c
Inline MaybeOwned in ConnectionSource and add another variant to store owned or ref connections
2020-03-15 02:58:41 -07:00
Ryan Leckey
4419aea619
update postgres/listen.rs for internal changes
2020-03-15 02:17:14 -07:00
Anthony Dodd
3db54dd724
Remove the Drop impl for PgPoolListener.
...
This is being removed as it was causing undesired behavior under some
contexts.
2020-03-15 02:17:14 -07:00
Anthony Dodd
82923a1aaa
Update stream impls.
...
The basic PgListener stream impl now yields `Result<PgNotification>`
elements without an `Option` in the result. The option condition
originally represented the closure of the underlying connection. Now
such conditions will terminate the stream, as one would expect. The
`PgListener.recv()` method signature has not been changed.
PgPoolListener has also been updated. The interfaces on this struct will
never yield an inner `Option` as it will instead acquire a new
connection and continue its work. Both the stream impl & the `recv`
method have received an update to their signatures.
2020-03-15 02:17:14 -07:00
Anthony Dodd
608556f91a
Impl Drop for PgPoolListener & add to exports.
2020-03-15 02:17:14 -07:00
Anthony Dodd
ae7e15cbe3
Added demo program to show use of LISTEN/NOTIFY.
2020-03-15 02:17:14 -07:00
Anthony Dodd
a0da99e128
A good bit of refactoring.
...
Broke up PgListener into two types. PgListener for basic one-off
connections, and PgPoolListener for the listener created from the
PgPool.
The API is a bit more clear now with this change in terms of reconnect
behavior and the like.
Update `fn stream` to be `fn into_stream`, as that nomenclature is a bit
more normative in the Rust ecosystem.
2020-03-15 02:17:14 -07:00
Anthony Dodd
f83180861b
Impl a few features & refactor some code based on design discussion.
...
Extension traits are now being used for PgConnection, PgPoolConnection &
PgPool for listen/notify functionality. Only two extension traits were
introduced.
Only a single trait method is present on the extension traits and it
works for single or multi channel listening setups.
Automatic reconnect behavior is implemented for PgPool based listeners.
All logic has been cut over to the `recv` impls for the PgListener
variants.
Use async-stream for a nice Stream interface.
2020-03-15 02:17:14 -07:00
Anthony Dodd
cb186e6a13
Updates from review and from testing.
2020-03-15 02:17:14 -07:00
Anthony Dodd
a52f36468b
Implement Postgres LISTEN interface.
...
This changeset introduces an interface for using PostgreSQL's LISTEN
functionality from within sqlx.
The listen interface is implemented over the PgConnection, PgPool & the
PgPoolConnection types for ease of use. In the case of PgPool, a new
connection is acquired, and is then used for LISTEN functionality.
Closes #87
2020-03-15 02:17:14 -07:00
Ryan Leckey
ab20db14a2
Remove Sqlite prefix from SqliteStatement as it is an internal API
2020-03-15 02:16:31 -07:00
Ryan Leckey
68d4a0d258
sqlite: produce connection specific errors
...
postgres, mysql: use derive for Debug for error types
2020-03-15 02:14:23 -07:00
Ryan Leckey
f667910cbf
sqlite: SqliteResultValue -> SqliteValue to match other drivers
2020-03-15 01:54:43 -07:00
Ryan Leckey
426361f361
sqlite: make SqliteConnection and Statement !Sync
2020-03-15 01:48:51 -07:00
Ryan Leckey
69b1d7feaa
sqlite: add even more notes about Send/Sync
2020-03-15 00:34:13 -07:00
Ryan Leckey
97b50b95c0
sqlite: ensure that we additionally clear the bindings when resetting the statement
2020-03-14 23:48:00 -07:00
Ryan Leckey
2abc451655
sqlite: re-order Executor methods
2020-03-14 23:45:14 -07:00
Ryan Leckey
21097e1436
sqlite: clarlify Sync guarantee
2020-03-14 23:45:03 -07:00
Ryan Leckey
dd99fc351c
suppress unused warnings
2020-03-14 19:54:19 -07:00
Ryan Leckey
cddaf1b34e
remove unused import for spawn_blocking
2020-03-14 19:47:36 -07:00
Ryan Leckey
69ea41de1e
sqlite: make the implementation far less naive
...
* WAL
* sync = NORMAL, thought on this for awhile, all signs point to this being a very good default for WAL usage
* separate worker thread per SQLite connection
2020-03-14 19:45:01 -07:00
Ryan Leckey
63ef32189d
sqlite: implement support for multiple statements
2020-03-14 17:43:44 -07:00
Ryan Leckey
0130fe1479
sqlite: implement describe
2020-03-14 17:43:44 -07:00
Ryan Leckey
5f27026459
sqlite: implement remainder of query API
2020-03-14 17:43:44 -07:00
Ryan Leckey
a3799c3496
sqlite: implement command execution
2020-03-14 17:43:44 -07:00
Ryan Leckey
751efdf31b
generalize MaybeOwnedConnection and clean up the connection file
2020-03-14 17:43:44 -07:00
Ryan Leckey
444ffff127
Run rustfmt
2020-03-14 17:43:44 -07:00
Ryan Leckey
30897dd6d9
Add additional notes to Executor
2020-03-14 17:43:44 -07:00
Ryan Leckey
0421c9fb42
Add explicit life times to Cursor
2020-03-14 17:43:44 -07:00
Ryan Leckey
1a48cf3b2c
Reduce some duplication in type parsing
2020-03-14 17:43:44 -07:00
Ryan Leckey
7ab07016da
sqlite: initial work in connection
2020-03-14 17:43:44 -07:00
Ryan Leckey
5d042e35b1
sqlite: stub
2020-03-14 17:43:44 -07:00