Closed darienmiller88 closed 2 years ago
"github.com/go-pg/pg/orm".CreateTableOptions{}
looks like its being imported from the non-module version.
go-pg expects you to use the module version *"github.com/go-pg/pg/v10/orm".CreateTableOptions
I think your imports are incorrect, or you are not using go modules.
These are my imports:
"github.com/go-pg/pg/orm"
"github.com/go-pg/pg/v10"
I'm pretty sure these are correct right?
I think you want github.com/go-pg/pg/v10/orm
instead of github.com/go-pg/pg/orm
Awesome, that was the issue! Thank you, closing this.
I just tried using using the migration method as stated in the example ->
db.Model(&User{}).CreateTable(&orm.CreateTableOptions{})
But unfortunately, I'm getting this error:
"cannot use &"github.com/go-pg/pg/orm".CreateTableOptions{} (type "github.com/go-pg/pg/orm".CreateTableOptions) as type "github.com/go-pg/pg/v10/orm".CreateTableOptions in argument to p.NewDB.baseDB.Model(&gorm.Model{}).CreateTable"
This doesn't make sense to me, as the
.CreateTable()
method clearly takes a reference to aCreateTableOptions{}
struct looking at the documentation.Expected Behavior
For the method to accept the above argument, a
CreateTableOptions{}
struct.Current Behavior
The above error is being displayed.
Steps to Reproduce