Théo OIRY
7cdb68be1a
support flatten attribute in FromRow macro ( #1959 )
...
* support flatten attribute in FromRow macro
* added docs for flatten FromRow attribute
2022-07-12 14:28:07 -07:00
Austin Bonander
bc3e70545b
sqlite improvements ( #1965 )
...
* use direct blocking calls for SQLite in `sqlx_macros`
* this also ensures the database is closed properly, cleaning up tempfiles
* don't send `PRAGMA journal_mode` unless set
* this previously defaulted to WAL mode which is a permanent setting
on databases which doesn't necessarily apply to all use-cases
* changing into or out of WAL mode acquires an exclusive lock on the database
that can't be waited on by `sqlite3_busy_timeout()`
* for consistency, `sqlx-cli` commands that create databases will still
create SQLite databases in WAL mode; added a flag to disable this.
* in general, don't send `PRAGMA`s unless different than default
* we were sending a bunch of `PRAGMA`s with their default values just to enforce
an execution order on them, but we can also do this by inserting empty slots
for their keys into the `IndexMap`
* add error code to `SqliteError` printout
* document why `u64` is not supported
2022-07-12 13:59:37 -07:00
LovecraftianHorror
d9fd21c94e
Don't cache sqlite connections for macros ( #1930 )
...
* fix(sqlx-macros): Don't cache sqlite connections for macros
* Explicity close SQLite connection in query macro
2022-07-09 14:35:24 -07:00
Kian-Meng Ang
d52f301a94
Fix typos ( #1894 )
...
* Fix typos
* Update CHANGELOG.md
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-06-08 14:56:56 -07:00
Michael Freeborn
1b9c40b3c8
fix serde_json usage in macros ( #1842 )
2022-05-31 16:58:11 -07:00
LovecraftianHorror
a2691b9635
Reuse a cached DB connection instead of always recreating for sqlx-macros ( #1782 )
...
* refactor: Reuse a cached connection instead of always recreating for `sqlx-macros`
* fix: Fix type inference issue when no database features used
* refactor: Switch cached db conn to an `AnyConnection`
* fix: Fix invalid variant name only exposed with features
* fix: Tweak connection options for SQLite with `sqlx-macros`
* fix: Remove read only option for SQLite connection
* fix: Fix feature flags regarding usage of `sqlx_core::any`
2022-05-25 18:22:09 -07:00
LovecraftianHorror
826e63fc11
refactor(sqlx-macros): Ignore deps when getting metadata for workspace root ( #1823 )
2022-04-21 12:36:15 -07:00
Paolo Barbolini
a97208c016
postgres: use Oid type everywhere instead of u32 ( #1602 )
...
* postgres: use Oid type instead of u32
* Make serde happy
* Expose the inner u32
* docs
* Try to fix tests
* Fix unit tests
* Fix order
* Not sure what happened here
2022-04-14 15:07:45 -07:00
Pruthvikar Reddy
cc1ab90110
Fix Rust type for SQLite REAL ( #1785 )
...
REAL is stored as as 8-byte IEEE floating point number
See https://www.sqlite.org/datatype3.html#storage_classes_and_datatypes
2022-04-14 15:05:38 -07:00
Tomáš Drtina
f4ed7e6ee8
Added support all variants of NUMERIC[] using decimal feature like bigdecimal does. ( #1781 )
2022-04-04 13:54:25 -07:00
Carol (Nichols || Goulding)
f5392151f3
Derive PgHasArrayType for transparent sqlx types ( #1748 )
...
Fixes #1744 .
2022-03-23 16:41:36 -07:00
Paolo Barbolini
5b85a034da
Update heck to 0.4 ( #1725 )
2022-02-28 15:51:50 -08:00
Bastian
dd39e79f8a
Support for lquery ( #1710 )
...
* initial lquery version
* share code between ltree/lquery
* more lquery functions
* fix rebase issues
* add version comment
* Update sqlx-core/src/postgres/types/lquery.rs
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
Co-authored-by: Bastian Schubert <bastian.schubert@crosscard.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-02-17 15:06:35 -08:00
Bastian
6674e8ba96
Basic support for ltree ( #1696 )
...
* support ltree
* add default and push to PgLTree
* add more derived for ltree
* fix copy/paste
* Update sqlx-core/src/error.rs
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
* PR fixes
* ltree with name instead of OID
* custom ltree errors
* add pop ot PgLTree
* do not hide ltree behind feature flag
* bytes() instead of chars()
* apply extend_display suggestion
* add more functions to PgLTree
* fix IntoIter
* resolve PR annotation
* add tests
* remove code from arguments
* fix array
* fix setup isse
* fix(postgres): disable `ltree` tests on Postgres 9.6
Co-authored-by: Bastian Schubert <bastian.schubert@crosscard.com>
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-02-15 20:40:03 -08:00
LovecraftianHorror
8f41f5b77a
refactor: Keep parsed sqlx-data.json in a cache instead of reparsing ( #1684 )
2022-02-15 20:17:47 -08:00
Austin Bonander
d25ab07f21
fix(test): fix mismatched type error in MySQL type tests ( #1517 )
...
* fix new warning about trailing semicolon in expression macros
* fix(test): fix mismatched type error in MySQL type tests
2021-10-26 13:45:46 -07:00
Emil Gardström
2eb4ff8713
don't assert #[repr(...)] on #[derive(sqlx::Type)] unless needed ( #1305 )
2021-08-31 18:08:43 -07:00
Robert Collins
89ee690550
Don't require cargo to build offline queries ( #1415 )
...
In particular building with bazel and cargo-raze doesn't imply having
cargo at all, and deferring the lookup allows same-crate builds to
succeed with no change to semantics.
Fixes #1414
Signed-off-by: Robert Collins <robert.collins@cognite.com>
2021-08-31 17:35:50 -07:00
Austin Bonander
c04f83bcfe
fix(macros): use resolve_path when getting path for include_str!() ( #1392 )
...
fixes #1387
2021-08-20 15:46:32 -07:00
Fredrik Østrem
e7c3610e85
fix: Ignore __CARGO_FIX_PLZ when running "cargo metadata" in macro ( #1352 )
2021-08-16 16:36:18 -07:00
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
toshokan
eda78a7258
Fix infinite compile loop regression from recursive Lazy reference
2021-05-24 09:31:55 -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
Siddhant
012478d8b7
Added support for PgMoney type in sqlx macros
2021-05-21 16:48:33 -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
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