187 Commits

Author SHA1 Message Date
Austin Bonander
17e88ac1a4 perf: implement pool benchmark, make fairness an option 2020-07-03 05:59:20 -07:00
Ryan Leckey
4c5ea7af77 Merge remote-tracking branch 'dimtion/pginterval' 2020-07-02 23:35:05 -07:00
Ryan Leckey
cfa833fa0d fix(sqlite): fallback to storage class when typing expressions and infer INTEGER as i64 2020-06-27 19:17:46 -07:00
Ryan Leckey
331b92dee7 Revert "refactor(derives): use separate impls per database"
This reverts commit e3483230e04a244181c67a0b7752d2406923b12c.
2020-06-27 18:55:10 -07:00
Loïc Carr
71cb68b2f4 feat(postgres) Create bindings for PgInterval 2020-06-27 17:36:06 -07:00
Ryan Leckey
e3483230e0 refactor(derives): use separate impls per database
database-generic impls are *mostly* impossible in SQLx so we recently
capitalized on that and made it *totally* impossible (until Rust
has specialization and lazy norm)
2020-06-27 05:30:38 -07:00
Austin Bonander
36a53b44cd fix(macros): don't emit typechecking code for explicit type overrides on bind params 2020-06-21 06:06:53 -07:00
Austin Bonander
f2515e2472 feat(macros): support nullable column override 2020-06-21 06:06:53 -07:00
Austin Bonander
7b37ebde0f fix(macros): forbid casts to _ in bind parameters 2020-06-21 06:06:53 -07:00
Austin Bonander
14023e8e6e feat(macros): support wildcard in bind param type overrides 2020-06-21 06:06:53 -07:00
Austin Bonander
eb831382e5 feat(macros): type override annotations for columns 2020-06-21 06:06:53 -07:00
Ryan Leckey
aaa475cc33 refactor: move Decode::accepts to Type::compatible 2020-06-21 03:55:31 -07:00
Daniel Akhterov
639e10248e
feat: add boolean support to sqlx-macros/mssql 2020-06-16 13:40:53 -07:00
Ryan Leckey
c9f3e1adca feat(postgres): add support for built-in range types and allow derives to handle custom range types
Co-authored-by: Caio <c410.f3r@gmail.com>
2020-06-12 15:33:19 -07:00
Ryan Leckey
fedd883d91 style: rustfmt 2020-06-12 15:33:19 -07:00
Caio
d4329e98d4 refactor: prepare to support postgres ranges
- Remove Type bound from Encode + Decode which removes the defaults 
   for produces() and accepts(). This allows custom type implementations
   to be more flexible.
2020-06-12 15:33:19 -07:00
Austin Bonander
646823e093 fix(macros): fix derive for Encode 2020-06-11 03:36:34 -07:00
Ryan Leckey
6497d67b6a feat(mssql): add macro support 2020-06-07 16:29:46 -07:00
Austin Bonander
80b4e2fca6
fix(macros): reintroduce and fix macro tests for MySQL 2020-06-05 21:02:24 -07:00
Austin Bonander
bddb2e560f
fix(macros): fix macros for Postgres 2020-06-05 20:28:21 -07:00
dignifiedquire
9b68eb19ef fix(sqlx-macros): update trait definitions 2020-06-05 19:49:31 -07:00
Ryan Leckey
a3053119fa fix: expose runtime-actix in sqlx/Cargo.toml 2020-06-01 05:34:52 -07:00
Ryan Leckey
51ae9f00e7
chore: bump version to 0.4.0-pre 2020-05-30 23:15:52 -07:00
Ryan Leckey
d4d994bae4
fix: found a few more changes needed in internal core usage in macros 2020-05-30 18:11:05 -07:00
Ryan Leckey
e8aa127c55
fix: tweak sqlx-core usage in macros after the latest massive refactor 2020-05-30 17:56:19 -07:00
Ryan Leckey
e5b6047009
feat: introduce docker-compose based testing for running locally against many database combinations 2020-05-30 17:51:55 -07:00
Ryan Leckey
9d2a0141cb
feat: introduce IntoArguments, query_with, query_as_with, and query_scalar_with 2020-05-30 17:51:55 -07:00
Ryan Leckey
a54b1267f6
refactor(macros): adapt to the 0.4.x core refactor 2020-05-30 17:51:49 -07:00
Austin Bonander
1bdc3e9057 cargo sqlx prepare: fix to consistently trigger recompile 2020-05-30 16:02:37 -07:00
Austin Bonander
03773d0065 sqlx-macros: simplify query_macros module name, delete unused file 2020-05-30 16:02:37 -07:00
Austin Bonander
a44e29c84c remove superfluous "TODO" 2020-05-30 16:02:37 -07:00
Austin Bonander
6b248e0d5f get offline macros working with todos example 2020-05-30 16:02:37 -07:00
Austin Bonander
21041ff55e implement cargo sqlx prepare
also organize code more clearly in `cargo-sqlx`
2020-05-30 16:02:37 -07:00
Austin Bonander
6913695588 add support for building in "decoupled" mode 2020-05-30 16:02:37 -07:00
Blaine Bublitz
33915ae3ad Add uppercase support for Type macro 2020-05-20 20:33:03 -07:00
Ryan Leckey
cbccd68963
chore: prepare v0.3.5 2020-05-06 03:30:35 -07:00
Dan B
e7c1486005 Add support for crate specific .env files
This change will attempt to load an .env file from CARGO_MANIFEST_DIR, if it exists.

For backwards compatibility, if the .env file does not exist, we will fall back to default dotenv behaviour.

Resolves #267
2020-04-24 15:40:20 -07:00
Josh Holmer
8b78680d9c Add snake_case rename support for Type macro
I encountered a use case while converting a project
from Diesel to sqlx, where I had a custom Postgres enum
which included a snake case field name:

```rust
pub enum JobStatus {
    NotRun,
    Finished,
    Failed,
}
```

Which translates to:

```sql
CREATE TYPE job_status AS ENUM ('not_run', 'finished', 'failed');
```

This is likely to be a semi-common use case,
so this commit adds snake case support for enums
via the `#[sqlx(rename_all = "snake_case")]` attribute.
2020-04-17 03:59:19 -04:00
meh
bfc52ca2f4 Add query_unchecked and query_file_unchecked macros 2020-04-16 09:54:09 -07:00
Ryan Leckey
90fd35745c Prepare v0.3.4 2020-04-10 15:56:13 -07:00
xiaopengli89
b354ed430d implement DECIMAL type support for mysql 2020-04-10 15:35:58 -07:00
sid
012c186069 support rename attribute in FromRow macro 2020-04-07 14:49:34 -07:00
Ryan Leckey
e7ace2adc7 Prepare v0.3.3 2020-04-01 18:24:08 -07:00
Ryan Leckey
4dc634f8b5 postgres: add a test to prove Type derive works for structs and fix the issue with it
fixes #219
2020-04-01 16:40:04 -07:00
Ryan Leckey
a9fc05378e Prepare v0.3.2 2020-03-31 03:02:01 -07:00
Ryan Leckey
a84e1f6626 Prepare v0.3.1 2020-03-30 18:53:03 -07:00
sid
40f11ebb77 Process keyword fields correctly in FromRow macro
This PR fixes the the incorrect handling of keywords fields of a struct in the FromRow macro.
Currently a struct with a field like 'r#type' will try to read values from a column with the exact same name with r# prefix. With this change this field will now map to a database column with the correct name 'type' without the r# prefix.
2020-03-30 19:30:50 +05:30
Ryan Leckey
fc3d06bf9b Prepare v0.3.0 2020-03-29 16:27:41 -07:00
Ryan Leckey
3d590c5d66 macros: remove try_unwrap_optional from _unchecked codepath 2020-03-29 01:27:57 -07:00
Austin Bonander
6fde5a2579 implement nullability on macro output, test postgres 2020-03-28 17:50:27 -07:00