Austin Bonander
a46e370c94
feat: document and expand query builder ( #1790 )
...
elaborates on the API introduced in #1780
2022-04-12 13:22:47 -07:00
crajcan
a470682572
Add Query builder ( #1780 )
...
* Add Query builder
* Make query_builder.rs in sqlx-core
* Add QueryBuilder::new()
* Add QueryBuilder::push()
* Define questions for documentation
* Get new, push, push_bind working with types
* Handle postgres' numbered bind varaibles
* Add a test for QueryBuilder#build
* Move arguments into Option
* Refactor query builder
* Finish testing QueryBuilder#build
* Remove design doc
* Add a test for pushing strings with push_bind
* Integration test green
* Adjust some tests
* Make query builder generic about placeholder segmenent ('$N' or '?')
* Run fmt
* Redesign Arguments#format_placeholder in line with code review
* Use write! to push sql to QueryBuilder
* Add QueryBuilder::reset to allow for QueryBuilder reuse
* Run cargo fmt
2022-04-08 13:36:42 -07:00
Malhar Vora
cc35809708
Address #1718 ( #1719 )
...
Fix broken link
2022-02-22 12:16:43 -08:00
k-jun
c90d2714ff
docs(macros): remove sentences banning usage of as _ ( #1619 )
...
* docs(macros): remove sentents banning `as _`
* fix(macros): comment
* Update src/macros.rs
* Update src/macros.rs
Co-authored-by: keijun-kumagai <keijun.kumagai@dena.com>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2022-02-15 21:13:39 -08:00
p9s
f3ac717977
Update macros.rs ( #1657 )
...
typo fix
2022-02-07 20:02:14 -08:00
Douman
04109d9323
Reimport Either used in Executor ( #1562 )
...
* Reimport Either used in Executor
* Re-import sqlx-core
* Update src/lib.rs
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
* Apply fmt
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2021-12-29 13:01:16 -08:00
Zbigniew Żołnierowicz
ce801b9330
Include a reference to the shape of the migration files in the migrate macro documentation ( #1498 )
2021-11-08 19:02:01 -08:00
Jonas Platte
335eed4545
Add executor trait "aliases" ( #1412 )
2021-08-31 17:36:27 -07:00
Rafael Epplée
e77219f7c7
Add docs for fetch_all, example for postgres transactions ( #1255 )
...
* reference fetch_all() in query macros
* add example for using transactions in postgres
2021-08-16 16:33:42 -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
Rafael Epplée
0acb0e5eff
Add docs for rename_all attribute for Type derive macro ( #1212 )
...
* add missing closing bracket in doctest
* document rename_all attribute for Type derive
2021-05-21 16:12:16 -07:00
jtroo
5a8418e5fd
Fix query! documentation of .execute ( #1179 )
2021-04-20 17:22:47 -07:00
Chris Pick
c83427f8fc
Fix sqlx-cli crate link ( #1139 )
...
Co-authored-by: Chris Pick <chris@chrispick.com>
2021-03-26 21:40:32 -07:00
Austin Bonander
89305873b0
fix(postgres): patch nullable inference in Postgres using EXPLAIN
...
BREAKING CHANGE: some columns in `query!()` et. al. output will change from `T` to `Option<T>`
breakage should be minimal in practice as
these columns will need to have been manually
overridden anyway to avoid runtime errors
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-01-20 22:27:44 -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
Ryan Leckey
d5e0f1b92b
refactor: rename DbOutcome to DbQueryResult
2021-01-20 21:57:26 -08:00
Jonas Platte
08a76f45ae
Rename DbDone to DbOutcome
2021-01-12 14:45:01 +01:00
Jonas Platte
a1d562f04b
Remove the Done trait
2021-01-12 14:37:44 +01:00
Jonas Platte
b3f78b8255
Add a trybuild test for sqlx(rename) deprecation warning
2021-01-12 03:39:10 -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
9eca6413fe
Remove TryMapRow and MapRow
...
These traits were a workaround for a bug in rustc that an earlier
revision of the API triggered, but the API has since been changed.
2021-01-05 23:50:23 -08:00
Chloe Ross
2890d154a3
doc: use the fancy new intra-crate doc links everywhere
2021-01-04 18:39:03 -08:00
Austin Bonander
ef6c73c985
doc: add tables describing the right method to call on query!() et al
...
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-01-04 12:03:42 -08:00
Marcin Kaźmierczak
7f1bff406d
fix clipyy warnings
2020-11-24 16:15:22 -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
Eric Semeniuc
abb71120f0
Fixes migration macro with no params
...
Fixes issue experienced in https://github.com/launchbadge/sqlx/issues/746 when using no parameter:
```
error: paths relative to the current file's directory are not currently supported
--> src/db.rs:7:5
|
7 | sqlx::migrate!().run(&conn).await?;
| ^^^^^^^^^^^^^^^^
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
```
2020-10-22 21:48:57 -07:00
drklee3
dfb096eaa7
docs(macros): Add missing closing bracket in code example
2020-08-15 18:32:38 -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
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
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
Ryan Leckey
40f0a22765
Merge remote-tracking branch 'magurotuna/doc-links'
2020-07-24 07:33:27 -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
Austin Bonander
41bf5e30ee
docs(macros): mention interpreting EXPLAIN output for SQLite
...
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-07-23 20:19:08 -07:00
Raphaël Thériault
92646e00b8
Fix migrate! and add migration test
2020-07-23 17:46:27 -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
Yusuke Tanaka
0890313259
doc: fix wrong links
2020-07-24 00:31:05 +09:00
Austin Bonander
67ad43491d
doc: adjust macros documentation
...
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-07-21 22:40:13 -07:00
Austin Bonander
94aa698581
refactor(macros): remove ResultExt and macro_result!()
2020-07-21 21:19:31 -07:00
Ryan Leckey
6949b84e8c
style: rustfmt
2020-07-15 02:31:57 -07:00
Ryan Leckey
3884bf272d
refactor: expose Encode/Decode from crate root
2020-07-15 02:05:13 -07:00
Ryan Leckey
00137d4a04
feat: add sqlx::Done and return from Executor::execute()
...
+ Done::rows_affected()
+ Done::last_insert_id()
2020-07-14 04:31:25 -07:00
Ryan Leckey
93cab2a197
test: more pool usage adjustments
2020-07-12 05:02:40 -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
0a74b16f4f
support string concatenation in query*
2020-07-09 12:34:19 -07:00