Giter VIP home page Giter VIP logo

realworld-rust-axum-sqlx's Introduction

License: MIT CI Coverage Codecov

realworld_logo

A fullstack implementation of the RealWorld project using Rust, axum, sqlx, and yew.

To get started, install Docker and cargo-make on your local machine (Windows users may want to use WSL for ease of development), then clone/fork the repository. Once you have the project local to your machine, create an .env file local to workspace with valid values (you can use the defaults as well).

cp .env.example .env

Next, create and start our Docker containers:

cargo make docker

Once the application containers have started, verify all integration tests pass:

cargo make integration

The above target will run the included Postman suite of tests designed by the authors of the RealWorld project. Once the tests have completed, verify all unit tests are passing as well:

cargo make test

Again, the target above will run all included unit tests found in the project. To run the frontend project using trunk:

cargo make web

Project Structure

This project is more or less a Rust playground for myself and others to learn Rust, axum, and sqlx. We utilize cargo workspaces to help encapsulate project-specific logic/domains, with a rough organization strategy as follows:

  • crates/conduit-bin - API entry point, consisting of a single main.rs file to drive startup and wire library dependencies together
  • crates/conduit-web - (in progress) web frontend project utilizing yew
  • crates/conduit-api - web API project housing axum specific setup, endpoints, routing, request/response marshalling, etc.
  • crates/conduit-core - core logic and contract definitions between domains, services, and repository
  • crates/conduit-domain - a simple project to house PORS (plain old rust structs) used for API request and responses, services, etc.
  • crates/conduit-infrastructure - a project adapter containing implementations of the core business logics definitions from higher up
  • integrations - contains the RealWorld Postman test scripts and collection
  • cypress - contains the e2e tests used to test the frontend project (crates/conduit-web)
  • deploy - contains all Docker Compose files used for building the project containers
  • .husky - contains husky git hooks

Why is there package.json file?

I use husky for pre-commit hooks and lint-staged to format staged files to keep committed code well formatted. While there are a few other options for including pre-commit hooks into a Rust project, and certainly those that are more appropriate for Rust projects, I wanted to leave open the opportunity of bringing on a TS-based frontend sometime in the future to have the true RealWorld fullstack experience. The pre-commit hooks will format, lint, and test all code so that each commit ensure that tests are passing and code does not contain any obvious errors.

To bypass the included hooks, simply pass a --no-verify flag while committing code

git commit -m "feat(core): add some amazing unit tests" --no-verify

Using Docker

The project utilizes Docker containers for Postgres and Prometheus metrics, as well as containers for the API and frontend. For example, when starting the application with cargo make docker, navigating to localhost:9090 will bring you to the Prometheus metrics page. From there, running integration tests with cargo make integration to simulate traffic to the API allows one to observe the various metrics that are recorded in the service layer: request count, request latency, and histograms of service request intervals.

To start the API outside the Docker context, run:

cargo make dev # or cargo run

The dev tasks takes on the postgres task as a dependency, so your database container will start automatically.

If you're starting the application for the first time, it will attempt to seed a bit of data that is also used for testing.

TODO

There's a lot more unit tests to write...

realworld-rust-axum-sqlx's People

Contributors

joeymckenzie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

realworld-rust-axum-sqlx's Issues

Use jsonwebtoken instead of jwt for auth

I propose as an enhancement to use the jsonwebtoken crate instead of the jwt crate because the jwt crate's last update was two years ago and seems to be unmaintained.
Also the jsonwebtoken crate is the most used JWT crate at the moment, is actively maintained and is the "standard" for this purpose.
Thanks for your great work!

cargo make docker failed

when i try deploy with docker-compose ,
run command cargo make docker , failed with follow output,i dont know how to solve

[cargo-make] INFO - cargo make 0.36.13
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: docker
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Execute Command: "docker" "compose" "-f" "./deploy/docker-compose.metrics.yml" "-f" "./deploy/docker-compose.postgres.yml" "-f" "./deploy/docker-compose.conduit-bin.yml" "-f" "./deploy/docker-compose.conduit-web.yml" "up" "--build"
[+] Building 6.1s (30/32)                                                                                                    
 => [realworld_rust_axum_sqlx_conduit_bin internal] load build definition from Dockerfile                               0.0s
 => => transferring dockerfile: 2.04kB                                                                                  0.0s
 => [realworld_rust_axum_sqlx_conduit_bin internal] load .dockerignore                                                  0.0s
 => => transferring context: 2B                                                                                         0.0s
 => [realworld_rust_axum_sqlx_conduit_web internal] load build definition from Dockerfile                               0.0s
 => => transferring dockerfile: 1.08kB                                                                                  0.0s
 => [realworld_rust_axum_sqlx_conduit_web internal] load .dockerignore                                                  0.0s
 => => transferring context: 2B                                                                                         0.0s
 => [realworld_rust_axum_sqlx_conduit_bin internal] load metadata for docker.io/library/debian:11.3-slim                1.1s
 => [realworld_rust_axum_sqlx_conduit_bin internal] load metadata for docker.io/library/rust:1.61.0-slim-bullseye       1.1s
 => [realworld_rust_axum_sqlx_conduit_web internal] load metadata for docker.io/library/nginx:latest                    0.0s
 => [realworld_rust_axum_sqlx_conduit_web deploy 1/2] FROM docker.io/library/nginx:latest                               0.0s
 => [realworld_rust_axum_sqlx_conduit_web internal] load build context                                                  0.1s
 => => transferring context: 9.67kB                                                                                     0.0s
 => [realworld_rust_axum_sqlx_conduit_bin build  1/13] FROM docker.io/library/rust:1.61.0-slim-bullseye@sha256:e649e00  0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin deploy 1/4] FROM docker.io/library/debian:11.3-slim@sha256:f695745801  0.0s
 => ERROR [realworld_rust_axum_sqlx_conduit_bin deploy 2/4] RUN set -eux;     export DEBIAN_FRONTEND=noninteractive;    4.9s
 => [realworld_rust_axum_sqlx_conduit_bin internal] load build context                                                  0.1s
 => => transferring context: 21.97kB                                                                                    0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_web build  2/13] WORKDIR /app                                              0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  3/13] COPY ./rust-toolchain ./                                  0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  4/13] COPY ./Cargo.lock ./                                      0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  5/13] COPY ./Cargo.toml ./                                      0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  6/13] COPY ./.env.docker ./.env                                 0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  7/13] COPY ./crates/conduit-bin ./crates/conduit-bin            0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  8/13] COPY ./crates/conduit-web ./crates/conduit-web            0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build  9/13] COPY ./crates/conduit-api ./crates/conduit-api            0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build 10/13] COPY ./crates/conduit-core ./crates/conduit-core          0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build 11/13] COPY ./crates/conduit-domain ./crates/conduit-domain      0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_bin build 12/13] COPY ./crates/conduit-infrastructure ./crates/conduit-in  0.0s
 => CANCELED [realworld_rust_axum_sqlx_conduit_bin build 13/13] RUN --mount=type=cache,target=/app/target     --mount=  4.9s
 => CACHED [realworld_rust_axum_sqlx_conduit_web build 3/5] COPY ./crates/conduit-web ./crates/conduit-web              0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_web build 4/5] COPY ./crates/conduit-domain ./crates/conduit-domain        0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_web build 5/5] RUN --mount=type=cache,target=/app/target     --mount=type  0.0s
 => CACHED [realworld_rust_axum_sqlx_conduit_web deploy 2/2] COPY --from=build /app/crates/conduit-web/dist /usr/share  0.0s
 => [realworld_rust_axum_sqlx_conduit_web] exporting to image                                                           0.0s
 => => exporting layers                                                                                                 0.0s
 => => writing image sha256:d659bb082fe2842538244837cd8f277890c9d814c1c93e688fff4f04d8eca8fe                            0.0s
 => => naming to docker.io/library/deploy-realworld_rust_axum_sqlx_conduit_web                                          0.0s
------
 > [realworld_rust_axum_sqlx_conduit_bin deploy 2/4] RUN set -eux;     export DEBIAN_FRONTEND=noninteractive;     apt update;     apt install --yes --no-install-recommends bind9-dnsutils iputils-ping iproute2 curl ca-certificates htop;     apt clean autoclean;     apt autoremove --yes;     rm -rf /var/lib/{apt,dpkg,cache,log}/;:
0.286 + export DEBIAN_FRONTEND=noninteractive
0.286 + apt update
0.293 
0.293 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.293 
0.767 Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
1.034 Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
1.495 Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
1.704 Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
4.337 Reading package lists...
4.897 E: Release file for http://security.debian.org/debian-security/dists/bullseye-security/InRelease is not valid yet (invalid for another 4d 3h 8min 1s). Updates for this repository will not be applied.
4.897 E: Release file for http://deb.debian.org/debian/dists/bullseye-updates/InRelease is not valid yet (invalid for another 3d 11h 37min 49s). Updates for this repository will not be applied.
------
failed to solve: process "/bin/sh -c set -eux;     export DEBIAN_FRONTEND=noninteractive;     apt update;     apt install --yes --no-install-recommends bind9-dnsutils iputils-ping iproute2 curl ca-certificates htop;     apt clean autoclean;     apt autoremove --yes;     rm -rf /var/lib/{apt,dpkg,cache,log}/;" did not complete successfully: exit code: 100
[cargo-make] ERROR - Error while executing command, exit code: 17
[cargo-make] WARN - Build Failed.

-- system:
CentOS Linux release 7.9.2009 (Core)

-- rust toolchain:
Default host: x86_64-unknown-linux-gnu
rustup home: /root/.rustup

stable-x86_64-unknown-linux-gnu (overridden by '/root/realworld-rust-axum-sqlx/rust-toolchain')
rustc 1.71.1 (eb26296b5 2023-08-03)

-- docker-compose version:
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2k-fips 26 Jan 2017

Unable to run 'cargo make docker'

Hi,
I tried to follow the instructions in the README but it fails when running cargo make docker (using Debian in WSL2).
I see the conduit-web is marked as WIP so is there a more stable commit I could try running this on?

Many thanks for making this example!

Logs

$ cargo make docker
[cargo-make] INFO - cargo make 0.36.3
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: docker
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Execute Command: "docker" "compose" "-f" "./deploy/docker-compose.metrics.yml" "-f" "./deploy/docker-compose.postgres.yml" "-f" "./deploy/docker-compose.conduit-bin.yml" "-f" "./deploy/docker-compose.conduit-web.yml" "up" "--build"
[+] Building 2.6s (33/34)                                                                                                                                                                                                                                                                    
 => [deploy-realworld_rust_axum_sqlx_conduit_web internal] load build definition from Dockerfile                                                                                                                                                                                        0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                                     0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_bin internal] load build definition from Dockerfile                                                                                                                                                                                        0.0s
 => => transferring dockerfile: 32B                                                                                                                                                                                                                                                     0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_web internal] load .dockerignore                                                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                         0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_bin internal] load .dockerignore                                                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                         0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_web internal] load metadata for docker.io/library/nginx:latest                                                                                                                                                                             2.2s
 => [deploy-realworld_rust_axum_sqlx_conduit_web internal] load metadata for docker.io/library/rust:1.61.0-slim-bullseye                                                                                                                                                                2.1s
 => [deploy-realworld_rust_axum_sqlx_conduit_bin internal] load metadata for docker.io/library/debian:11.3-slim                                                                                                                                                                         1.9s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                                                                                                                                                                           0.0s
 => [auth] library/rust:pull token for registry-1.docker.io                                                                                                                                                                                                                             0.0s
 => [auth] library/nginx:pull token for registry-1.docker.io                                                                                                                                                                                                                            0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_web build  1/13] FROM docker.io/library/rust:1.61.0-slim-bullseye@sha256:e649e005ae0cf04ed9db8f577dbabbed6cc25da4f0b63595e4f90146f5129bab                                                                                                  0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_bin internal] load build context                                                                                                                                                                                                           0.0s
 => => transferring context: 250.56kB                                                                                                                                                                                                                                                   0.0s
 => [deploy-realworld_rust_axum_sqlx_conduit_bin deploy 1/4] FROM docker.io/library/debian:11.3-slim@sha256:f6957458017ec31c4e325a76f39d6323c4c21b0e31572efa006baa927a160891                                                                                                            0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin deploy 2/4] RUN set -eux;     export DEBIAN_FRONTEND=noninteractive;     apt update;     apt install --yes --no-install-recommends bind9-dnsutils iputils-ping iproute2 curl ca-certificates htop;     apt clean autoclean;     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin deploy 3/4] WORKDIR /deploy                                                                                                                                                                                                     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_web build  2/13] WORKDIR /app                                                                                                                                                                                                       0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  3/13] COPY ./rust-toolchain ./                                                                                                                                                                                           0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  4/13] COPY ./Cargo.lock ./                                                                                                                                                                                               0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  5/13] COPY ./Cargo.toml ./                                                                                                                                                                                               0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  6/13] COPY ./.env.docker ./.env                                                                                                                                                                                          0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  7/13] COPY ./crates/conduit-bin ./crates/conduit-bin                                                                                                                                                                     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  8/13] COPY ./crates/conduit-web ./crates/conduit-web                                                                                                                                                                     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build  9/13] COPY ./crates/conduit-api ./crates/conduit-api                                                                                                                                                                     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build 10/13] COPY ./crates/conduit-core ./crates/conduit-core                                                                                                                                                                   0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build 11/13] COPY ./crates/conduit-domain ./crates/conduit-domain                                                                                                                                                               0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_bin build 12/13] COPY ./crates/conduit-infrastructure ./crates/conduit-infrastructure                                                                                                                                               0.0s
 => CANCELED [deploy-realworld_rust_axum_sqlx_conduit_bin build 13/13] RUN --mount=type=cache,target=/app/target     --mount=type=cache,target=/usr/local/cargo/registry     --mount=type=cache,target=/usr/local/cargo/git     --mount=type=cache,target=/usr/local/rustup     set -e  0.4s
 => [deploy-realworld_rust_axum_sqlx_conduit_web internal] load build context                                                                                                                                                                                                           0.0s
 => => transferring context: 4.75kB                                                                                                                                                                                                                                                     0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_web deploy 1/2] FROM docker.io/library/nginx:latest@sha256:e209ac2f37c70c1e0e9873a5f7231e91dcd83fdf1178d8ed36c2ec09974210ba                                                                                                         0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_web build 3/5] COPY ./crates/conduit-web ./crates/conduit-web                                                                                                                                                                       0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_web build 4/5] COPY ./crates/conduit-domain ./crates/conduit-domain                                                                                                                                                                 0.0s
 => CACHED [deploy-realworld_rust_axum_sqlx_conduit_web build 5/5] RUN --mount=type=cache,target=/app/target     --mount=type=cache,target=/usr/local/cargo/registry     --mount=type=cache,target=/usr/local/cargo/git     --mount=type=cache,target=/usr/local/rustup     set -eux    0.0s
 => ERROR [deploy-realworld_rust_axum_sqlx_conduit_web deploy 2/2] COPY --from=build /app/crates/conduit-web/dist /usr/share/nginx/html                                                                                                                                                 0.0s
------
 > [deploy-realworld_rust_axum_sqlx_conduit_web deploy 2/2] COPY --from=build /app/crates/conduit-web/dist /usr/share/nginx/html:
------
failed to solve: failed to compute cache key: "/app/crates/conduit-web/dist" not found: not found
[cargo-make] ERROR - Error while executing command, exit code: 17
[cargo-make] WARN - Build Failed.```

make docker error

make docker

#0 193.0    Compiling conduit-infrastructure v0.1.0 (/app/conduit-infrastructure)
#0 193.2 error: failed to find data for query with updated_article_cte as (
#0 193.2            update articles
#0 193.2                set updated_at = current_timestamp,
#0 193.2                    title = $1::varchar,
#0 193.2                    slug = $2::varchar,
#0 193.2                    description = $3::varchar,
#0 193.2                    body = $4::varchar
#0 193.2                where id = $5
#0 193.2                returning id as "id",
#0 193.2                    created_at as "created_at",
#0 193.2                    updated_at as "updated_at",
#0 193.2                    title as "title",
#0 193.2                    body as "body",
#0 193.2                    slug as "slug",
#0 193.2                    description as "description",
#0 193.2                    user_id as "user_id")
#0 193.2        select a.id          as "id!",
#0 193.2               a.created_at  as "created_at!",
#0 193.2               a.updated_at  as "updated_at!",
#0 193.2               a.title       as "title!",
#0 193.2               a.body        as "body!",
#0 193.2               a.slug        as "slug!",
#0 193.2               a.description as "description!",
#0 193.2               u.username    as "author_username!",
#0 193.2               u.bio         as "author_bio!",
#0 193.2               u.image       as "author_image!"
#0 193.2        from updated_article_cte a
#0 193.2                 join users u on u.id = a.user_id;
#0 193.2   --> conduit-infrastructure/src/repositories/articles_repository.rs:54:9
#0 193.2    |
#0 193.2 54 | /         query_file_as!(
#0 193.2 55 | |             UpsertArticleQuery,
#0 193.2 56 | |             "queries/update_article.sql",
#0 193.2 57 | |             title,
#0 193.2 ...  |
#0 193.2 61 | |             id
#0 193.2 62 | |         )
#0 193.2    | |_________^
#0 193.2    |
#0 193.2    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)
#0 193.2 
#0 193.2 error: failed to find data for query select a.id                                                                                           as "id!",
#0 193.2               a.created_at                                                                                   as "created_at!",
#0 193.2               a.updated_at                                                                                   as "updated_at!",
#0 193.2               a.title                                                                                        as "title!",
#0 193.2               a.body                                                                                         as "body!",
#0 193.2               a.description                                                                                  as "description!",
#0 193.2               a.slug                                                                                         as "slug!",
#0 193.2               u.id                                                                                           as "user_id!",
#0 193.2               exists(select 1 from user_favorites af where af.user_id = $1::bigint and af.article_id = a.id) as "favorited!",
#0 193.2               (select count(*) from user_favorites where article_id = a.id)                                  as "favorites!",
#0 193.2               exists(select 1
#0 193.2                      from user_follows
#0 193.2                      where followee_id = a.user_id
#0 193.2                        and follower_id = $1::bigint)                                                            "following_author!",
#0 193.2               u.username                                                                                     as "author_username!",
#0 193.2               u.bio                                                                                          as "author_bio!",
#0 193.2               u.image                                                                                        as "author_image!"
#0 193.2        from articles a
#0 193.2                 join users u on u.id = a.user_id
#0 193.2             -- filter on users for the author
#0 193.2        where ($2::varchar is null or $2::varchar = u.username)
#0 193.2          -- filter on tags, if applicable
#0 193.2          and ($3::varchar is null or exists(
#0 193.2                select 1
#0 193.2                from tags t
#0 193.2                         join article_tags at on (t.id, a.id) = (at.tag_id, at.article_id)
#0 193.2                where tag = $3::varchar
#0 193.2            ))
#0 193.2          -- filter on the favoriting user
#0 193.2          and ($4::varchar is null or exists(
#0 193.2                select 1
#0 193.2                from users favoriting_user
#0 193.2                         join user_favorites f on favoriting_user.id = f.user_id
#0 193.2                where favoriting_user.username = $4::varchar)
#0 193.2            )
#0 193.2        order by a.created_at desc
#0 193.2        limit $5::integer offset $6::integer
#0 193.2   --> conduit-infrastructure/src/repositories/articles_repository.rs:77:9
#0 193.2    |
#0 193.2 77 | /         query_file_as!(
#0 193.2 78 | |             GetArticleQuery,
#0 193.2 79 | |             "queries/get_articles.sql",
#0 193.2 80 | |             user_id,
#0 193.2 ...  |
#0 193.2 85 | |             offset as i32
#0 193.2 86 | |         )
#0 193.2    | |_________^
#0 193.2    |
#0 193.2    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)
#0 193.2 
#0 193.2 error: failed to find data for query select a.id                                                          as "id!",
#0 193.2               a.created_at                                                  as "created_at!",
#0 193.2               a.updated_at                                                  as "updated_at!",
#0 193.2               a.title                                                       as "title!",
#0 193.2               a.body                                                        as "body!",
#0 193.2               a.description                                                 as "description!",
#0 193.2               a.slug                                                        as "slug!",
#0 193.2               u.id                                                          as "user_id!",
#0 193.2               exists(
#0 193.2                       select 1 from user_favorites af where af.user_id = $1::bigint and af.article_id = a.id
#0 193.2                   )                                                         as "favorited!",
#0 193.2               (select count(*) from user_favorites where article_id = a.id) as "favorites!",
#0 193.2               exists(select 1
#0 193.2                      from user_follows
#0 193.2                      where followee_id = a.user_id
#0 193.2                        and follower_id = $1::bigint)                           "following_author!",
#0 193.2               u.username                                                    as "author_username!",
#0 193.2               u.bio                                                         as "author_bio!",
#0 193.2               u.image                                                       as "author_image!"
#0 193.2        from articles a
#0 193.2                 join users u on u.id = a.user_id
#0 193.2        where a.slug = $2::varchar;
#0 193.2   --> conduit-infrastructure/src/repositories/articles_repository.rs:93:9
#0 193.2    |
#0 193.2 93 |         query_file_as!(GetArticleQuery, "queries/get_article_by_slug.sql", user_id, slug)
#0 193.2    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0 193.2    |
#0 193.2    = note: this error originates in the macro `$crate::sqlx_macros::expand_query` (in Nightly builds, run with -Z macro-backtrace for more info)
#0 193.2 
#0 194.2 error: could not compile `conduit-infrastructure` due to 3 previous errors
#0 194.2 warning: build failed, waiting for other jobs to finish...
------
failed to solve: executor failed running [/bin/sh -c set -eux;     rustup install stable;     cargo build --workspace --release;     objcopy --compress-debug-sections target/release/conduit-bin ./conduit]: exit code: 101
make: *** [Makefile:15:docker] 错误 17

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.