package main

import (
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/sqlite"
)

type Product struct {
	gorm.Model
	Code  string
	Price uint
}

func main() {
	db, err := gorm.Open("sqlite3", "/tmp/test.db")

	if err != nil {
		panic(err)
	}

	defer db.Close()

	db.AutoMigrate(&Product{})

	db.Create(&Product{Code: "sdfasdfasdf", Price: 1000})
}

Изменить пасту