diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-20 18:35:50 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2022-06-20 18:35:50 +0200 |
commit | 4e5b2d9dfd9413ce084e64e048a57ad6e23356d3 (patch) | |
tree | 674754d58838a219871304fd8fc57b44d2193160 /db | |
parent | a4cd5de795926537318f94aa34c9f2579c29fc11 (diff) | |
download | mdir-4e5b2d9dfd9413ce084e64e048a57ad6e23356d3.tar.gz mdir-4e5b2d9dfd9413ce084e64e048a57ad6e23356d3.tar.bz2 mdir-4e5b2d9dfd9413ce084e64e048a57ad6e23356d3.zip |
ref: Remove model dependency fom worker
It was a bit weird to have that dependency in first place.
Diffstat (limited to 'db')
-rw-r--r-- | db/model.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/db/model.go b/db/model.go index 01d9b9f..0a5ca98 100644 --- a/db/model.go +++ b/db/model.go @@ -16,27 +16,27 @@ type EntryModel struct { DB *gorm.DB } -func (m EntryModel) Find(id string) Entry { +func (m *EntryModel) Find(id string) Entry { var entry Entry where := "id = " + id m.DB.Where(where).FirstOrInit(&entry) return entry } -func (m EntryModel) All() []Entry { +func (m *EntryModel) All() []Entry { var entries []Entry m.DB.Find(&entries) return entries } -func (m EntryModel) Create(entry *Entry) { +func (m *EntryModel) Create(entry *Entry) { m.DB.Create(entry) } -func (m EntryModel) Update(entry Entry) { +func (m *EntryModel) Update(entry Entry) { m.DB.Save(&entry) } -func (m EntryModel) Delete(id string) { +func (m *EntryModel) Delete(id string) { m.DB.Delete(&Entry{}, id) } |