Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to AppContext instead of direct field access #101

Merged
merged 1 commit into from
May 9, 2024

Conversation

spencewenski
Copy link
Member

This makes it slightly more ergonomic to contain the app context state with an "inner" type that's wrapped by an Arc.

This also allows consumers to disallow direct access to specific fields using clippy's
disallowed-methods lint. This is useful, for example, if consumers want to provide their own method for accessing the DB that performs some logic before/after the DB operations, e.g. for implementing RLS.

This makes it slightly more ergonomic to contain the app context state
with an "inner" type that's wrapped by an Arc.

This also allows consumers to disallow direct access to specific fields
using clippy's
[disallowed-methods](https://rust-lang.github.io/rust-clippy/master/index.html#/disallowed_methods)
lint. This is useful, for example, if consumers want to provide their
own method for accessing the DB that performs some logic before/after
the DB operations, e.g. for implementing RLS.
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 117 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/controller/health.rs 0.00% <ø> (ø)
src/cli/mod.rs 0.00% <0.00%> (ø)
src/config/service/http/initializer.rs 78.84% <0.00%> (ø)
src/config/service/mod.rs 0.00% <0.00%> (ø)
src/service/http/builder.rs 0.00% <0.00%> (ø)
src/service/http/initializer/normalize_path.rs 0.00% <0.00%> (ø)
src/service/http/middleware/catch_panic.rs 0.00% <0.00%> (ø)
src/service/http/service.rs 0.00% <0.00%> (ø)
src/service/worker/sidekiq/service.rs 0.00% <0.00%> (ø)
src/app.rs 0.00% <0.00%> (ø)
... and 13 more

@spencewenski spencewenski merged commit b70596f into main May 9, 2024
5 of 6 checks passed
@spencewenski spencewenski deleted the app-context-methods branch May 9, 2024 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant