feat: Convert Carbon Object To Pointer #278
Merged
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.
As per this issue #249 makes bundle size large because each call creates a new
Carbon
objectThis pull request includes changes to the
Carbon
package to modify methods and tests to use pointer receivers instead of value receivers. This change ensures that any modifications within these methods directly affect the originalCarbon
instance, improving performance and consistency.Changes to method signatures:
boundary.go
to change method receivers from value to pointer for methods likeStartOfCentury
,EndOfCentury
,StartOfDecade
,EndOfDecade
,StartOfYear
,EndOfYear
,StartOfQuarter
,EndOfQuarter
,StartOfMonth
,EndOfMonth
,StartOfWeek
,EndOfWeek
,StartOfDay
,EndOfDay
,StartOfHour
,EndOfHour
,StartOfMinute
,EndOfMinute
,StartOfSecond
, andEndOfSecond
. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]Changes to unit tests:
boundary_unit_test.go
to change thecarbon
field in test structs from value to pointer for test functions likeTestCarbon_StartOfCentury
,TestCarbon_EndOfCentury
,TestCarbon_StartOfDecade
,TestCarbon_EndOfDecade
,TestCarbon_StartOfYear
,TestCarbon_EndOfYear
,TestCarbon_StartOfQuarter
,TestCarbon_EndOfQuarter
,TestCarbon_StartOfMonth
,TestCarbon_EndOfMonth
,TestCarbon_StartOfWeek
,TestCarbon_EndOfWeek
,TestCarbon_StartOfDay
,TestCarbon_EndOfDay
,TestCarbon_StartOfHour
,TestCarbon_EndOfHour
,TestCarbon_StartOfMinute
,TestCarbon_EndOfMinute
,TestCarbon_StartOfSecond
, andTestCarbon_EndOfSecond
. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]Changes to
calendar.go
:calendar.go
to use pointer receivers forLunar
,Julian
, andPersian
conversions, and changed the return type ofCreateFromLunar
andCreateFromJulian
to pointers. [1] [2]