* 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.
I'd prefer to have one but I'd rather not have one then one that doesn't compile.
Ideally someone could take up maintaining a realworld example outside of SQLx. Until GATs though we
should keep this to one database. Looking back, most of the reason this is so hard to migrate to 0.4 is
because of how generic the bounds are.
* Adds tables for storing articles, tags, favorites, and comments.
* Implements all remaining web APIs (articles, tags, profiles, etc)
* Refactors `Provide` traits into
* `ProvideAuthn` is used to store/retrieve user info
* `ProvideData` is used to retrieve application data
* ` Provide` traits are now implemented on Connections instead of Pools
* Introduces `Db` trait that encapsulates DB connections
* Cleans up endpoint functions
**General**
* Moves `examples/postgres/realworld` to `examples/realworld`
* The app is now architected to support multiple DBs
* Adds feature flags for `sqlite` and `postgres` to allow user to choose
which backend to use
*NOTE* Currently it is not possible to compile with `postgres` and `sqlite`
enabled as we are using the `query!` and `query_as!` macros and they
seem to get unhappy.
* Adds CLI flags for picking the DB backend to use at runtime
* Adds schema file and implementation for SQLite for `/api/user` routes
* Adds stub routes and trait for articles and Articles entity
**Changes**
* We now use i32 instead of i64 as the user_id to get around some quirks
w/ the SQLite driver.
* Reimplements existing route handlers w/ an error handling shim so we can use
Try inside the biz logic
* *FIX* Adds a `user` key to the register user body to conform w/ realworld's
API specs
APIs were functionally tested using realworld's API test script
(https://github.com/gothinkster/realworld/tree/master/api#authentication)
* Updated the README example with acquire connection
Initially from reading the docs and examples I tried to use `&mut pool` instead of `&mut conn`. The compiler gave me an error that `Pool<MySql>` didn't implement `Executor`. I had to do a bit of digging and eventually just viewed the source of `Pool` to find `acquire()`, `try_acquire()` etc.
I think this change makes it a bit easier for someone to get started.
* Update README.md to reference initial pool declaration
* Fixed compile issues and added examples of using &mut &pool