From 73b1e5746a3f074aa103b5914a02769ff057c56e Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 16 Jun 2022 22:36:03 +0200 Subject: fix: Pass entry as reference It was not getting the object created by gorm so `.ID` was 0 causing all sort of weird iterations. That is also cause by the lack of testes. That will also be fixed in the next commits. --- db/model.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'db') diff --git a/db/model.go b/db/model.go index 4b814f9..01d9b9f 100644 --- a/db/model.go +++ b/db/model.go @@ -29,8 +29,8 @@ func (m EntryModel) All() []Entry { return entries } -func (m EntryModel) Create(entry Entry) { - m.DB.Create(&entry) +func (m EntryModel) Create(entry *Entry) { + m.DB.Create(entry) } func (m EntryModel) Update(entry Entry) { -- cgit v1.2.3