Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Enhance the validator to properly convert carbon.Carbon values into Go time.Time and extend test suites to cover these new behaviors.
- Added a
time.Timeconversion case incastValuewithinvalidator.go - Updated
validation/validator_test.goto importtimeandconvert, added fields forTime/*Time, and new test scenarios covering full and date‐only strings
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| validation/validator.go | Added case reflect.TypeOf(time.Time{}) to convert carbon.Carbon into time.Time |
| validation/validator_test.go | Imported time & convert, added Time/*Time fields and test cases for binding and casting |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1046 +/- ##
=======================================
Coverage 70.48% 70.49%
=======================================
Files 176 176
Lines 12339 12343 +4
=======================================
+ Hits 8697 8701 +4
Misses 3261 3261
Partials 381 381 ☔ View full report in Codecov by Sentry. 🚀 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.
📑 Description
This pull request enhances the
Validatorfunctionality by adding support for thetime.Timetype and extends test coverage to validate this new feature. The main changes include updates to thecastValuemethod invalidation/validator.goand the addition of test cases invalidation/validator_test.go.Enhancements to
Validatorfunctionality:time.TimeincastValue: Added logic to handletime.Timetype in thecastValuemethod, convertingcarbon.Carboninstances to standard Gotime.Timeobjects. (validation/validator.go, validation/validator.goR202-R205)Test coverage improvements:
TestBind_RuleandTestCastValueto includetime.Timeand pointer totime.Time. (validation/validator_test.go, [1] [2] [3]time.Time: Added test cases to validatetime.Timeparsing, including scenarios for full datetime strings and date-only strings. (validation/validator_test.go, validation/validator_test.goR547-R580)TestCastValueto verify correct handling oftime.Timeand pointer totime.Timein various scenarios. (validation/validator_test.go, [1] [2]Additional changes:
timeandconvertpackages to support the new functionality. (validation/validator.go, [1];validation/validator_test.go, [2] [3]✅ Checks