Skip to content

Commit

Permalink
feat: export getLocalTimeWithTimezoneName (#360)
Browse files Browse the repository at this point in the history
Co-authored-by: Anqi <[email protected]>
  • Loading branch information
haysons and Nicole00 authored Jan 17, 2025
1 parent e8eeb1c commit 5312ccf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions result_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ func (t TimeWrapper) getLocalTimeWithTimezoneOffset(timezoneOffsetSeconds int32)
Microsec: int32(localTime.Nanosecond() / 1000)}, nil
}

// getLocalTimeWithTimezoneName returns a nebula.Time object
// GetLocalTimeWithTimezoneName returns a nebula.Time object
// representing local time using user specified timezone name.
// Year, month, day in time.Time are filled with 0.
//
Expand All @@ -1075,7 +1075,7 @@ func (t TimeWrapper) getLocalTimeWithTimezoneOffset(timezoneOffsetSeconds int32)
//
// Otherwise, the name is taken to be a location name corresponding to a file
// in the IANA Time Zone database, such as "America/New_York".
func (t TimeWrapper) getLocalTimeWithTimezoneName(timezoneName string) (*nebula.Time, error) {
func (t TimeWrapper) GetLocalTimeWithTimezoneName(timezoneName string) (*nebula.Time, error) {
// Original time object generated from server in UTC
// Year, month and day are mocked up to fill the parameters
rawTime := time.Date(2020,
Expand Down
4 changes: 2 additions & 2 deletions result_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestAsTime(t *testing.T) {
t.Error(err.Error())
}

localTime, err := timeWrapper.getLocalTimeWithTimezoneName("Asia/Shanghai")
localTime, err := timeWrapper.GetLocalTimeWithTimezoneName("Asia/Shanghai")
if err != nil {
t.Error(err.Error())
}
Expand All @@ -195,7 +195,7 @@ func TestAsTime(t *testing.T) {
}
assert.Equal(t, expected, *localTime)

localTime, err = timeWrapper.getLocalTimeWithTimezoneName("America/Los_Angeles")
localTime, err = timeWrapper.GetLocalTimeWithTimezoneName("America/Los_Angeles")
if err != nil {
t.Error(err.Error())
}
Expand Down

0 comments on commit 5312ccf

Please sign in to comment.