Search before asking
What happened
I want to get primary key of my model, using Dalgorm.GetPrimaryKeyFields method, but it always lost the field of type time.Time.
my model with 3 primary keys

only get two string column as primary keys

What you expected to happen
Dalgorm.GetPrimaryKeyFields should return all primary keys of model.
How to reproduce
- Define a model with any field of type time.Time
- Set the time.Time field as primary key with gorm tag
gorm:"primaryKey"
- call
Dalgorm.GetPrimaryKeyFields
Anything else
With a deep looking for, GetPrimaryKeyFields will walk all fields for target model with utils.WalkFields. And utils.WalkFields treat time.Time as a struct, so it walks into time.Time. It causes the problem.
https://github.com/apache/incubator-devlake/blob/3a0f52eec956c2bd98ab196335fcfd0ec096cc01/impl/dalgorm/dalgorm.go#L167
Version
main
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
I want to get primary key of my model, using
Dalgorm.GetPrimaryKeyFieldsmethod, but it always lost the field of type time.Time.my model with 3 primary keys
only get two string column as primary keys
What you expected to happen
Dalgorm.GetPrimaryKeyFieldsshould return all primary keys of model.How to reproduce
gorm:"primaryKey"Dalgorm.GetPrimaryKeyFieldsAnything else
With a deep looking for,
GetPrimaryKeyFieldswill walk all fields for target model withutils.WalkFields. Andutils.WalkFieldstreattime.Timeas a struct, so it walks intotime.Time. It causes the problem.https://github.com/apache/incubator-devlake/blob/3a0f52eec956c2bd98ab196335fcfd0ec096cc01/impl/dalgorm/dalgorm.go#L167
Version
main
Are you willing to submit PR?
Code of Conduct