cannot use r.db (type *"gorm.io/gorm".DB) as type *"github.com/jinzhu/gorm".DB
Closed this issue · 6 comments
mattn commented
I'm trying to build tutorial app using copper but following error occured.
func (r *PostsRepo) GetPostByID(ctx context.Context, id string) (*Post, error) {
db := csql.GetConn(ctx, r.db)
fmt.Println(db)
return nil, nil
}
.\main.go:30:27: cannot use r.db (type *"gorm.io/gorm".DB) as type *"github.com/jinzhu/gorm".DB in argument to csql.GetConn
tusharsoni commented
Hi @mattn, can you make sure that you are using github.com/jinzhu/gorm
in your import statements and try again?
I believe the gorm repository has moved to gorm.io/gorm
but Copper has not been updated to use that yet.
mattn commented
You use github.com/jinzhu/gorm here.
https://github.com/tusharsoni/copper/blob/7d4e7be0368e2c3e575b6dc89ff33f3296ac6a43/csql/sql.go#L9
mattn commented
mattn commented
Ah, sorry. I did not read your mention.
I believe the gorm repository has moved to gorm.io/gorm but Copper has not been updated to use that yet.
Yes, I'm waiting the fix. Thank you. :)
tusharsoni commented
This should now be fixed in ffe3eeb!
mattn commented
Thank you!