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

fix(os/gtime): fix gtime.Value() when time only, add time only example #3714

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

niluan304
Copy link
Contributor

@niluan304 niluan304 commented Jul 27, 2024

add only time case for func (t *Time) Value() (driver.Value, error):

// Value is the interface providing the Value method for package database/sql/driver
// for retrieving value from golang variable to database.
func (t *Time) Value() (driver.Value, error) {
	if t == nil {
		return nil, nil
	}
	if t.IsZero() {
		return nil, nil
	}

	if t.Year() == 0 {
		// Only time.
		return t.Format("15:04:05"), nil
	}

	return t.Time, nil
}

the pr can Fixes #2012

add some time only example.

@niluan304 niluan304 force-pushed the fix/gtime-sql-value branch from 0b07730 to 43f497d Compare July 29, 2024 13:04
@niluan304 niluan304 requested a review from gqcn July 29, 2024 13:22
@cyjaysong
Copy link
Contributor

看看我这种方案如何
#3712

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Let’s see how my plan goes
#3712

@niluan304 niluan304 force-pushed the fix/gtime-sql-value branch from c7ace83 to 7df22f4 Compare August 10, 2024 11:34
Copy link

@gqcn gqcn merged commit a6c361d into gogf:master Aug 14, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants