I am a beginner golang developer I use GORM package to connect to DB. How to migration and a model like following in GORM:
type Product struct {
    ID         int64
    Name       string
    created_at  int64
    updated_at  int64
}
                You can migrate to your database with following command
db.AutoMigrate(&Product{})
This command migrates if product model does not exist in database
This is usually used as a CREATE statement
you can also see here to more information. GORM migration document
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With