We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
my model structure looks like bellow
type Status struct { Id int64 AuthorId int64 Description string `sql:"size:255"` PublishDate time.Time }
When I create a new record & save
myStatus:= Status{ AuthorId : business1.Id, Description: "I got stuck here", PublishDate : time.Date(2013, time.January, 22, 23, 59, 59, 0, time.UTC), } DB.save(&myStatus)
it successfully save the record in MySQL database like bellow
+----+-----------+------------------+---------------------+ | id | author_id | description | publish_date | +----+-----------+------------------+---------------------+ | 1 | 1 | I got stuck here | 2013-01-22 23:59:59 | +----+-----------+------------------+---------------------+
when I try to retrieve the record from MySQL database, like bellow
var allStatus []Status DB.Find(&allStatus)
I gives me following error
sql: Scan error on column index 3: unsupported driver -> Scan pair: []uint8 -> *time.Time
The text was updated successfully, but these errors were encountered:
Did you connect mysql with parseTime option?
db, err = Open("mysql", "gorm:gorm@/gorm?charset=utf8&parseTime=True")
Sorry, something went wrong.
thanks @jinzhu I completely missed the 'parseTime' part
No branches or pull requests
my model structure looks like bellow
When I create a new record & save
it successfully save the record in MySQL database like bellow
when I try to retrieve the record from MySQL database, like bellow
I gives me following error
The text was updated successfully, but these errors were encountered: