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

33
things/resource.go Normal file
View File

@ -0,0 +1,33 @@
package things
import (
"log"
"wails-template/model"
"gorm.io/gorm"
)
type Service struct {
DB *gorm.DB
}
func (s *Service) NewThing(name string) {
if err := s.DB.Save(&model.Thing{Name: name}).Error; err != nil {
log.Fatal(err)
}
print(name)
}
func (s *Service) GetThings() (things []model.Thing) {
if err := s.DB.Find(&things).Error; err != nil {
log.Fatal(err)
}
return things
}
func (s *Service) DeleteThing(id int) {
if err := s.DB.Delete(model.Thing{}, id).Error; err != nil {
log.Fatal(err)
}
}