Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export getLocalTimeWithTimezoneName #360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions result_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,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 @@ -953,7 +953,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