Commit graph

351 commits

Author SHA1 Message Date
Austin Bonander
b3ae6e50de
fix(macros): prefix generated variable names in query_as!() (#1336)
closes #1322
2021-07-21 17:24:39 -07:00
Austin Bonander
e89cb0971a
fix(macros): tell the compiler about external files/env vars to watch (#1332)
* fix(macros): tell the compiler about external files/env vars to watch

closes #663
closes #681

* feat(cli): add `migrate` subcommand for generating a build script

suggest embedding migrations on `sqlx migrate add` in a new project
2021-07-21 16:36:22 -07:00
nomick
be189bd11e
Support MACADDR in Postgres (#1329) 2021-07-19 16:55:53 -07:00
Jonas Platte
e33e4510fc
Fix error message about wildcard overrides (#1276)
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2021-06-15 15:12:49 -07:00
Rohan Sharma
358b80f62e
Rename _expr to expr (#1264) 2021-06-01 12:20:12 -07:00
Ryan Leckey
694a2ac478 release: v0.5.5 2021-05-24 09:34:34 -07:00
toshokan
eda78a7258 Fix infinite compile loop regression from recursive Lazy reference 2021-05-24 09:31:55 -07:00
Ryan Leckey
5d9c292132 release: v0.5.4 2021-05-22 16:38:54 -07:00
Jonas Platte
901f858fbc
sqlx-data.json removal prep work (#1184)
* macros: Reduce I/O

by doing all .env and environment variable reading inside a Lazy initializer.

* Use the default runtime and TLS backend for all examples

Before, rust-analyzer was always hitting the
"only one runtime can be enabled" compile_error in sqlx-rt.
2021-05-21 17:33:56 -07:00
Ryan Leckey
13f7c7124a release: v0.5.3 2021-05-21 17:27:15 -07:00
Siddhant
012478d8b7 Added support for PgMoney type in sqlx macros 2021-05-21 16:48:33 -07:00
Ryan Leckey
f7775f7fde release: 0.5.2 2021-04-15 18:40:46 -07:00
Evgeny Nosov
8b866bb23d Fix migrate! macro 2021-04-08 23:50:39 -07:00
Kitsu
64e872ffd8
Remove redunant braces in type_name (#1153) 2021-04-05 13:11:37 -07:00
Ryan Leckey
b6e1275617
fix: derive(Type) should emit a forwarded impl for the compatible function 2021-03-18 16:12:00 -07:00
Jonas Platte
f9ff8aee38 Mark derived impl blocks #[automatically_derived] 2021-02-27 01:05:48 -08:00
Ryan Leckey
cbe820760f
release: 0.5.1 2021-02-04 09:16:11 -08:00
Ryan Leckey
efccd6c9b8
chore: update sqlx-rt to 0.3 2021-02-04 09:15:00 -08:00
Ryan Leckey
94d0baeb52
release: 0.5 2021-02-04 06:32:50 -08:00
Jonas Platte
a7eeacbef3 Rewrap lines in sqlx_macros::derives::{decode, encode} 2021-02-04 05:48:26 -08:00
Jonas Platte
c251ba1e12 Fix non-overridden type name not being quoted 2021-02-04 05:48:26 -08:00
Jonas Platte
cf97315c74 Replace qualified uses of proc_macro2::TokenStream 2021-02-04 05:48:26 -08:00
Rob Ede
e197d5b0e2 rt: update to actix-rt v2 2021-02-04 04:51:22 -08:00
Tom Dohrmann
cfe61a4724 fix typos 2021-02-03 01:58:57 -08:00
Tom Dohrmann
4f5f532909 fix paths for bool & fix typo 2021-02-03 01:58:57 -08:00
Tom Dohrmann
b4dc5c353e run cargo fmt 2021-02-03 01:58:57 -08:00
Tom Dohrmann
76326c6619 use absolute paths in macros 2021-02-03 01:58:57 -08:00
Jonas Platte
d3b7a0783e macros: Only depend on serde when it's actually used 2021-01-31 16:57:29 -08:00
Jonas Platte
6ad0a9ada7 macros: Only depend on once_cell when it's actually used 2021-01-31 16:57:29 -08:00
Austin Bonander
6b036055e5
format: run rustfmt 2021-01-20 22:26:48 -08:00
Austin Bonander
7c32928ebc
feat(macros): implement query_scalar!() and variants
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-01-20 22:23:04 -08:00
David Marcin
39544b1dd4 Allow symlinks to be followed for migration files 2021-01-20 22:13:50 -08:00
Jonas Platte
cdafc8ae17 Upgrade async runtime dependencies
Co-authored-by: Josh Toft <joshtoft@gmail.com>
Co-authored-by: Philip A Reimer <antreimer@gmail.com>
2021-01-20 21:49:46 -08:00
Jonas Platte
0758ffd10e Remove cargo_metadata dependency
It was not pulling its weight.

Just look at that Cargo.lock diff!
2021-01-13 23:05:56 -08:00
Jonas Platte
5d564167ca sqlx-macros: Replace lazy_static by once_cell 2021-01-13 23:05:56 -08:00
Jonas Platte
751fe03228 Clean up imports in sqlx_macros::query 2021-01-13 23:05:56 -08:00
Jonas Platte
52a7c35439 [offline] Use buffering for JSON file reading / writing 2021-01-13 23:05:56 -08:00
Jonas Platte
ce56f191ec Clean up some import grouping / ordering 2021-01-13 23:05:56 -08:00
Jonas Platte
e2f7aa2eca Restore support for sqlx(rename) on types, with a deprecation warning 2021-01-12 03:39:10 -08:00
Jonas Platte
fd8b2b7f8a Rename sqlx(rename) attribute to sqlx(type_name) 2021-01-12 03:39:10 -08:00
Kirill Bulatov
7cb49d2cd6 Fix the formatting 2020-12-29 11:30:34 -08:00
dragonn
63bbd3445b Fixing don't parse all attributes as Meta in parse_container_attributes 2020-12-26 06:40:28 -08:00
Ryan Leckey
80d02d203f
fix: when sqlx-macros enables migrate feature, enable in sqlx-core 2020-12-19 01:11:06 -08:00
Ryan Leckey
565d0a91a3
release: v0.4.2 2020-12-19 01:07:50 -08:00
Augusto
ef42bd44bd Adding support for vector of bytea type in postgres 2020-12-19 07:16:04 +00:00
Federico Rampazzo
05e42a8cac Cargo fmt 2020-12-19 07:14:09 +00:00
Federico Rampazzo
b9e57de005 Rename mixedCase to camelCase, CamelCase to PascalCase, aligning with serde 2020-12-19 07:14:09 +00:00
Federico Rampazzo
00a999145f Add mixedCase and CamelCase to rename-all, added rename-all to FromRow 2020-12-19 07:14:09 +00:00
Joe Grund
3e1da43434 Support workspaces for offline feature
This patch enables having a top-level `sqlx-data.json` file within a
workspace.

It does this by using a full clean / check instead of `cargo rustc`
which fails on a workspace.

A `--merged` flag is introduced to switch to the workspace behavior

Fixes #353.

Signed-off-by: Joe Grund <jgrund@whamcloud.io>
2020-12-19 05:17:07 +00:00
Pleto
9f99a8f3d2 add 1 as true for SQLX_OFFLINE env variable 2020-12-17 00:54:21 -08:00
Marcin Kaźmierczak
7f1bff406d fix clipyy warnings 2020-11-24 16:15:22 -08:00
Dominic
204a65a464 Fix path for &[NaiveTime] in query! macro 2020-11-24 16:08:53 -08:00
sid
e8c073c5e2 fix migrate marco to take migration type 2020-11-24 16:04:43 -08:00
o0Ignition0o
bfa58417a1 dontt allow(clippy::all) twice, just put one in brackets. 2020-11-19 14:06:25 -08:00
o0Ignition0o
52d482ffd1 Wrap allow(clippy::all) twice to avoid potential stability errors in the future. 2020-11-19 14:06:25 -08:00
o0Ignition0o
4b223af2d3 let's add a couple more brackets 2020-11-19 14:06:25 -08:00
o0Ignition0o
9dc039c1ff #[allow(clippy::all)] on all of the generated code. 2020-11-19 14:06:25 -08:00
o0Ignition0o
9d11c7a7f1 Allow clippy::suspicious_else_formatting when expanding query arguments.
Expanding several query arguments in the query! macro creates several if false { ... } statements, which in turn trigger clippy's suspicious_else_formatting (https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_else_formatting).
This commit allows the clippy lint so users won't be disturbed by it.
2020-11-19 14:06:25 -08:00
Jonas Platte
3c7c266eac Fix some clippy lints 2020-11-19 14:04:07 -08:00
Ryan Leckey
0b03dc6762 prepare v0.4.0 2020-11-12 07:46:13 -08:00
Jonas Platte
b14266ba2e Add rustls support 2020-11-12 07:32:59 -08:00
Jonas Platte
a161bcba05 Rename cargo features in preparation for rustls support 2020-11-12 07:32:21 -08:00
dragonn
7726e16292 Fixing don't parse all attributes as Meta 2020-11-04 17:11:47 -08:00
Jonas Platte
85b5ab0fb3 Fix cfg-specific unused lints 2020-10-29 22:21:27 -07:00
Jonas Platte
abdd29f145 Store query metadata only the current build is online
This should help with conflicting writes in some cases, but even without
issues like that it reduces useless I/O.
2020-10-29 22:21:27 -07:00
Timofey Martynov
5f793c6e95 Add ranges and range arrays types 2020-10-26 01:35:12 -07:00
dvermd
964837e255 Add #[derive(FromRow)] for tuple struct 2020-10-26 01:33:59 -07:00
Siddhant
1c725df406 Fixed formatting issue 2020-10-20 15:13:18 -07:00
Siddhant
e56ce0a998 Added support for kebab case for postgres enums 2020-10-20 15:13:18 -07:00
Max DaPrato
4bfd7a555f Enable support for Vec<DateTime<Utc>> 2020-10-19 15:06:08 -07:00
Ferenc Tamás
a46d7f8fdf fix(macro): offline env 2020-10-13 09:49:36 -07:00
Chloe Ross
5f3245d7f4 format: run cargo fmt 2020-07-31 04:14:48 -07:00
Chloe Ross
1949445cf0 other: don't deadname self 2020-07-31 04:14:48 -07:00
Chloe Ross
3885ae6ddf fix: allow queries that select just void to pass through macros as () instead of struct { _1: () } 2020-07-31 04:14:48 -07:00
Austin Bonander
4e00ee050d fix(macros): resolve clippy lint warning
cc https://github.com/rust-lang/rust-clippy/issues/5849

Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-07-28 03:21:05 -07:00
Julius de Bruijn
1a59d3308a Pg: Implementing BIT and VARBIT using BitVec 2020-07-27 03:36:44 -07:00
Ryan Leckey
22f1f93b79 chore: prepare sqlx v0.4.0-beta.1 and sqlx-cli v0.1.0-beta.1 2020-07-27 01:43:02 -07:00
Raphaël Thériault
ced09e0545
Support using both nullability and type overrides (#549)
* Make it possible to use both nullability and type overrides

* Fix override parsing lookahead logic

* Update column override tests

* Support nullability overrides with wildcard type overrides

* Fix tests

* Update query! overrides docs

* Remove last bits of macro_result!

* rustfmt
2020-07-27 00:43:35 -07:00
Ryan Leckey
d06de149a0 fix: get MatchBorrow type check working for references 3 deep 2020-07-26 23:07:12 -07:00
Ryan Leckey
ec0e84d8ac feat(mysql): support reading and writing BIT via unsigned integers
e.g., BIT(64) is u64 and BIT(2) is u8
2020-07-26 19:42:32 -07:00
Ryan Leckey
51c5d82fec fix: remove macro_result wrapper from migrate! 2020-07-26 18:06:06 -07:00
Ryan Leckey
f298eb3cf1 Merge remote-tracking branch 'raftario/embedded-migrations' 2020-07-26 18:03:59 -07:00
Ryan Leckey
86d41f17aa Merge remote-tracking branch 'origin/ab/macro-refresh' 2020-07-26 17:54:23 -07:00
Danny Weinberg
bd6b6e0365 Make names match their corresponding styles 2020-07-24 07:25:29 -07:00
Danny Weinberg
036bd2a05d Add SCREAMING_SNAKE_CASE rename_all option
This mirrors the addition of `uppercase` in https://github.com/launchbadge/sqlx/pull/304, but for all uppercase snake case.
2020-07-24 07:25:29 -07:00
Ryan Leckey
e575501a39 feat: add Executor::prepare, a hook into the automatic statement preparation life-cycle 2020-07-24 07:24:23 -07:00
Julius de Bruijn
590f97df4a Caching describe 2020-07-24 07:24:23 -07:00
Austin Bonander
4da66c9200
fix(macros): fix checked = false being ignored
for arguments

Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-07-23 19:53:08 -07:00
Raphaël Thériault
435445fbd0 Edit migrator to make it possible to create static instances 2020-07-23 17:54:05 -04:00
Raphaël Thériault
92646e00b8 Fix migrate! and add migration test 2020-07-23 17:46:27 -04:00
Raphaël Thériault
39b3e4a966 Normalise path resolution accross migrate! and query_file! 2020-07-23 17:11:35 -04:00
Raphaël Thériault
0eb63b7eae Fix migrate! and improve docs 2020-07-23 16:47:32 -04:00
Raphaël Thériault
8381e87d4a Document migrate! (and small fixes) 2020-07-23 15:25:13 -04:00
Raphaël Thériault
e5e9665bd9 Add migrate! macro for embedded migrations 2020-07-23 14:22:50 -04:00
Austin Bonander
94aa698581
refactor(macros): remove ResultExt and macro_result!() 2020-07-21 21:19:31 -07:00
Ryan Leckey
ae8800ccc4 feat(postgres): add () for VOID in macro resolution 2020-07-20 23:12:43 -07:00
Ryan Leckey
fa40e9e55f implement support for postgres TIMETZ type
Co-authored-by: Julius de Bruijn <julius+github@nauk.io>
2020-07-17 03:22:40 -07:00
Jonas Platte
4c394de70b Add SQLX_OFFLINE env variable to force metadata usage 2020-07-17 01:12:07 -07:00
Julius de Bruijn
92cddc76c8 Remove faulty Json declaration from macros 2020-07-15 03:19:23 -07:00
Ryan Leckey
b2ba00f4be feat(macros): turn on support for JSON in mysql and arrays of JSON in postgres 2020-07-15 02:31:44 -07:00