Skip to content

feat: add the relationship of facades and bindings#1233

Merged
hwbrzzl merged 4 commits intomasterfrom
bowen/optimize-facades
Oct 18, 2025
Merged

feat: add the relationship of facades and bindings#1233
hwbrzzl merged 4 commits intomasterfrom
bowen/optimize-facades

Conversation

@hwbrzzl
Copy link
Contributor

@hwbrzzl hwbrzzl commented Oct 18, 2025

📑 Description

This pull request introduces a new centralized facades package to standardize the mapping between facade names and their binding keys. It updates the container logic and related utility functions to use this new mapping, leading to cleaner and more maintainable code. The changes also refactor the setup and conversion logic to utilize the new constants and mappings.

  1. facades.Auth can be used instead of using an Auth string directly.
  2. Users can customize the relationship in the future.

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings October 18, 2025 11:08
@hwbrzzl hwbrzzl requested a review from a team as a code owner October 18, 2025 11:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new centralized facades package that standardizes the mapping between facade names and their binding keys, replacing hardcoded string literals and string manipulation logic throughout the codebase.

  • Adds a new contracts/facades/facades.go file with facade constants and a FacadeToBinding map
  • Updates container methods to use the new facade-to-binding mapping instead of hardcoded strings
  • Refactors facade/binding conversion functions to use the centralized mapping

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
contracts/facades/facades.go New file defining facade constants and mapping to binding keys
foundation/container.go Updates all Make* methods to use the new facade-to-binding mapping
support/convert/facade.go Replaces string manipulation logic with map-based lookups
auth/setup/setup.go Updates setup logic to use facade constants instead of string literals

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: cddc195 Previous: 2d07c62 Ratio
Benchmark_EncryptString 5093 ns/op 2152 B/op 14 allocs/op 1610 ns/op 2152 B/op 14 allocs/op 3.16
Benchmark_EncryptString - ns/op 5093 ns/op 1610 ns/op 3.16

This comment was automatically generated by workflow using github-action-benchmark.


import "github.com/goravel/framework/contracts/binding"

const (
Copy link
Member

@krishankumar01 krishankumar01 Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any chance that the facades and bindings will differ? The mapping seems to be the same? We can assume binding as facade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, currently, facades.Auth -> binding.Auth by default, but it can be facades.Auth -> binding.AnotherAuth in the future.

@codecov
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 12.06897% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.33%. Comparing base (2d07c62) to head (cddc195).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
foundation/container.go 6.06% 31 Missing ⚠️
auth/setup/setup.go 0.00% 19 Missing ⚠️
support/convert/facade.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1233      +/-   ##
==========================================
- Coverage   66.35%   66.33%   -0.03%     
==========================================
  Files         245      245              
  Lines       16914    16922       +8     
==========================================
+ Hits        11224    11225       +1     
- Misses       5308     5315       +7     
  Partials      382      382              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hwbrzzl hwbrzzl merged commit 34493df into master Oct 18, 2025
11 of 14 checks passed
@hwbrzzl hwbrzzl deleted the bowen/optimize-facades branch October 18, 2025 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants