Initial commit

This commit is contained in:
2025-03-10 09:21:24 +01:00
commit 037b593c6b
44 changed files with 6411 additions and 0 deletions

28
model/model.go Normal file
View File

@ -0,0 +1,28 @@
package model
import (
"log"
"os"
"path"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
)
type Thing struct {
ID int
Name string
}
func InitDB() *gorm.DB {
home, err := os.UserHomeDir()
if err != nil {
panic(err)
}
db, err := gorm.Open(sqlite.Open(path.Join(home, "things.db")))
if err != nil {
log.Panic(err)
}
db.AutoMigrate(&Thing{})
return db
}