9 Commits

Author SHA1 Message Date
Samani G. Gikandi
841d9a7f45 Changes PKs in realworld postgres to SERIAL
`GENERATED` was added in Postgres 12 and we test as far back as 9
2020-04-17 12:42:22 -07:00
Samani G. Gikandi
9fb523d4e8 Runs rustfmt across realworld 2020-04-17 12:42:22 -07:00
Samani G. Gikandi
8138a26b61 Finishes realworld example implementation
* 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
2020-04-17 12:42:22 -07:00
Samani G. Gikandi
7038dd8ab2 Refactors realworld example with multi DB support
**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)
2020-04-17 12:42:22 -07:00
Ryan Leckey
d76b1357da Audit MySql and Postgres protocols 2019-12-27 17:31:01 -08:00
Ryan Leckey
871183d23b Minor fixes and run rustfmt 2019-12-03 00:22:02 -08:00
Ryan Leckey
9558ab1c50 Remove bytes usage and update dependencies 2019-12-02 23:26:44 -08:00
Ryan Leckey
2227303f20 Have Backend require Executor and de-duplicate some logic 2019-11-27 23:26:20 -08:00
Ryan Leckey
1e6e21046a Just call the example realworld 2019-11-27 15:23:00 -08:00