feat: add struct binding example for URL parameters#44
Merged
miclle merged 4 commits intofox-gonic:mainfrom Dec 8, 2025
Merged
feat: add struct binding example for URL parameters#44miclle merged 4 commits intofox-gonic:mainfrom
miclle merged 4 commits intofox-gonic:mainfrom
Conversation
- Add .codecov.yml configuration file - Set coverage precision and range (70-100%) - Configure project and patch coverage thresholds - Enable coverage comments on PRs - Ignore test files and examples - Update GitHub Actions workflow - Add codecov/codecov-action@v5 step - Upload coverage.txt after tests - Only upload from ubuntu-latest to avoid duplicates - Use CODECOV_TOKEN secret for authentication This enables automatic coverage reporting on PRs and commits, making it easier to track test coverage changes.
Added a new endpoint /greet/:name that demonstrates using struct binding to extract URL parameters, providing an alternative to ctx.Param() method. Changes: - examples/01-basic/main.go: Add UserParams struct and /greet/:name endpoint - examples/01-basic/README.md: Update documentation with new example This shows both approaches: 1. ctx.Param() - direct parameter access 2. Struct binding - automatic parameter binding with validation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #44 +/- ##
=======================================
Coverage 87.87% 87.87%
=======================================
Files 16 16
Lines 726 726
=======================================
Hits 638 638
Misses 70 70
Partials 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the basic example by adding a demonstration of struct binding for URL parameters, showing developers two different ways to extract path parameters in Fox.
Changes
New Endpoint Added
GET /greet/:name- Demonstrates struct binding approachUpdated Documentation
Comparison of Two Approaches
1. Direct Parameter Access (existing)
2. Struct Binding (new)
Benefits
Testing
Files Changed
examples/01-basic/main.go- Added UserParams struct and new endpointexamples/01-basic/README.md- Updated documentation