gocopper/copper

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

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

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. :)

This should now be fixed in ffe3eeb!

mattn commented

Thank you!