Commit graph

1337 commits

Author SHA1 Message Date
Ryan Leckey
61e4a4f566 feat: finish v1 of both cli and embedded migrations 2020-07-12 03:43:55 -07:00
Ryan Leckey
b920aa1c55 feat: support user-defined array and pseudo types in postgres 2020-07-12 03:43:55 -07:00
Ryan Leckey
e765287dba refactor: restructure relationship between Pool, Connection, and Options
* Pool::new -> Pool::connect

 * Add Pool::connect_lazy

 * Pool::builder -> PoolOptions::new

 * PoolConnection no longer implements Connection

 * Transaction no longer implements Connection

 * Add ConnectOptions::connect

 * Add Acquire - abstract between &Pool and &mut Connection within one function

 * Remove Connect, move connect to Connection

Co-authored-by: Austin Bonander <austin@launchbadge.com>
2020-07-12 03:43:55 -07:00
Austin Bonander
c327e63f46 fix(macros): fix broken _unchecked macros
These should all expand to invocations of `expand_query!()` but I guess I missed a couple.

Closes #503

Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-07-09 13:10:19 -07:00
Mike Ledger
e731836e48 rust fmt wibble 2020-07-09 12:34:19 -07:00
Mike Ledger
03fcfc8562 concat test 2020-07-09 12:34:19 -07:00
Mike Ledger
ee106286a0 get span beforehand 2020-07-09 12:34:19 -07:00
Mike Ledger
627be88634 use Punctuated 2020-07-09 12:34:19 -07:00
Mike Ledger
bea5b8f612 fix warning 2020-07-09 12:34:19 -07:00
Mike Ledger
0a74b16f4f support string concatenation in query* 2020-07-09 12:34:19 -07:00
Julius de Bruijn
2e3e5187f9 Document better! 2020-07-09 12:32:19 -07:00
Julius de Bruijn
dce7c71c37 Add macro extensions for Decimal 2020-07-09 12:32:19 -07:00
Julius de Bruijn
08f55bfc28 Simplify mantissa handling 2020-07-09 12:32:19 -07:00
Julius de Bruijn
47de479454 Conversions from Decimal to PgMoney 2020-07-09 12:32:19 -07:00
Julius de Bruijn
e45e6d4173 Set the write part to use simpler math with u128 2020-07-09 12:32:19 -07:00
Julius de Bruijn
f246d41aed Fixed an overflow with a negative scale 2020-07-09 12:32:19 -07:00
Julius de Bruijn
245d53e484 Test Decimal conversions in my and pg 2020-07-09 12:32:19 -07:00
Julius de Bruijn
95ac38caed Add money conversions to Decimal 2020-07-09 12:32:19 -07:00
Julius de Bruijn
fd837fce09 Support for rust_decimal::Decimal 2020-07-09 12:32:19 -07:00
Julius de Bruijn
e3b3806db5 Handle ParameterStatus in PgStream 2020-07-06 05:56:10 -07:00
Ryan Leckey
41df13ba5a test(postgres): fix unreliable test that depends on the sequence number 2020-07-05 04:40:13 -07:00
Ryan Leckey
699df28088 test(postgres): remove usage of DataRow::len() in unit test 2020-07-05 04:37:53 -07:00
Ryan Leckey
15fc837366 fix: sqlite chrono type match after column metadata changes 2020-07-05 04:29:52 -07:00
Ryan Leckey
8baeb9215a fix: correct a couple places from the recent column metadata changes 2020-07-05 04:28:25 -07:00
Ryan Leckey
250b4d8e10 feat(any): update Any to support the new column metadata 2020-07-05 04:23:10 -07:00
Ryan Leckey
8d188c5f1a feat: expose column information on Row
- add database-specific Column types: MySqlColumn, PgColumn, etc.
 - add Row::columns() -> &[DB::Column]
 - add Row::column(I) and Row::try_column(I)
2020-07-05 03:48:36 -07:00
Ryan Leckey
266a583a6b fix: remove reference to accidentally added WIP module 2020-07-04 05:54:36 -07:00
Ryan Leckey
3b503a7764 feat(sqlite): clean up chrono support, add support for NaiveTime and NaiveDate 2020-07-04 05:51:46 -07:00
Ryan Leckey
7d22c0917f Merge remote-tracking branch 'meteficha/felipesere-rebased' 2020-07-04 04:37:11 -07:00
agentsim
7810f7dcdd
Sqlite Collation Support (#446)
* Sqlite Collation Support

Adds a method create_collation to SqliteConnection.
Adds a unit test confirming the collation works as expected.

* Fix formatting

* Address feedback

Co-authored-by: Ryan Leckey <ryan@launchbadge.com>
2020-07-04 04:30:40 -07:00
Ryan Leckey
aaa8b25050 test(sqlite): add a couple macro expression tests 2020-07-04 04:13:53 -07:00
Ryan Leckey
d112c4d807 feat(sqlite): support expressions and multiple no-data statements in the macros 2020-07-04 04:06:43 -07:00
Ryan Leckey
0def87b689 fix(derives): lift requirement of Copy + Clone on weak enums 2020-07-04 03:14:42 -07:00
Ryan Leckey
6a251efb65 fix(mysql): enum type derive and column overrides need to deref before eq 2020-07-04 02:59:56 -07:00
Ryan Leckey
d209c60eb7 feat(sqlite): add read_only to SqliteConnectionOptions 2020-07-04 02:55:01 -07:00
Ryan Leckey
3c3356675e fix(sqite): emit REAL for float columns in SQLite as the docs use that word a lot more 2020-07-04 02:54:41 -07:00
Ryan Leckey
921878ad77 fix: make sqlx_rt::block_on pub not pub(crate) 2020-07-03 06:18:24 -07:00
Austin Bonander
dfe5e31c52 perf: document sqlx-bench and pool fairness benchmark 2020-07-03 05:59:20 -07:00
Austin Bonander
e2c707b447 fix: make Pool::try_acquire() fair only when fair=true in the options 2020-07-03 05:59:20 -07:00
Austin Bonander
15e0a5553a chore: document PoolBuilder::fair() 2020-07-03 05:59:20 -07:00
Austin Bonander
17e88ac1a4 perf: implement pool benchmark, make fairness an option 2020-07-03 05:59:20 -07:00
Ryan Leckey
3a8dc0e211 fix(tests): prevent postgres::pool_smoke_test from starving executor 2020-07-03 05:59:20 -07:00
Austin Bonander
8c2acaa258 fix(pool): prevent calls to acquire() from cutting in line
add a few more checks for `is_closed`
2020-07-03 05:59:20 -07:00
Ryan Leckey
0824723765 fix: handle zero dates in MySQL, emit as Option::None (treat as NULL) 2020-07-03 05:50:06 -07:00
Ryan Leckey
0bd556e0ee test: double sleep time after mysql start up to hopefully stave off "connection aborted" errors in CI 2020-07-03 05:15:13 -07:00
Julius de Bruijn
83380eedbb Renaming as_bigdecimal to to_bigdecimal.
Following the Rust guidelines
2020-07-03 03:57:20 -07:00
Julius de Bruijn
0a4de7038d Remove the money compat functions from i64 2020-07-03 03:57:20 -07:00
Julius de Bruijn
744a4aa255 Make PgMoney as Copy 2020-07-03 03:57:20 -07:00
Julius de Bruijn
b3db51cdfc Implement a proper type for money 2020-07-03 03:57:20 -07:00
Julius de Bruijn
0c01ca966c Support for money type in Postgres
Reading is possible as `i64`, presenting the number of cents with the
default setting. The fractional precision depends on the `lc_monetary`
setting. By default the setting gives a fractional precision of 2.

Writing works with `i32`, `i64` or a numeric type such as `BigDecimal`.
When using an integer to write, it is not possible to represent cents.
Writing `123` to a money field stores a value of 12300.

When writing with a numeric type, cents can be represented. Reading
should still be done to an integer and if needed, converted to a numeric
type in the application to get the correct fractional precision.
2020-07-03 03:57:20 -07:00