From 7103019890960e793deefb64987a09b33be60b42 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Fri, 17 May 2024 15:20:30 -0700 Subject: Add golang server --- server/guests/models.go | 17 +++++++++++++++++ server/guests/store.go | 26 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 server/guests/models.go create mode 100644 server/guests/store.go (limited to 'server/guests') diff --git a/server/guests/models.go b/server/guests/models.go new file mode 100644 index 0000000..c68a4c3 --- /dev/null +++ b/server/guests/models.go @@ -0,0 +1,17 @@ +package guests + +type Guest struct { + Id int `json:"id"` + FirstName string `json:"firstName"` + LastName string `json:"lastName"` + Attendance string `json:"attendance"` + Email string `json:"email"` + Message string `json:"message"` + PartySize int `json:"partySize"` + PartyList []PartyGuest `json:"partyList"` +} + +type PartyGuest struct { + FirstName string `json:"firstName"` + LastName string `json:"lastName"` +} diff --git a/server/guests/store.go b/server/guests/store.go new file mode 100644 index 0000000..f1d8558 --- /dev/null +++ b/server/guests/store.go @@ -0,0 +1,26 @@ +package guests + +type MemStore struct { + guestMap map[int]Guest +} + +func NewMemStore() *MemStore { + guestMap := make(map[int]Guest) + return &MemStore{ + guestMap, + } +} + +func (m MemStore) Get() (map[int]Guest, error) { + return m.guestMap, nil +} + +func (m MemStore) Add(id int, guest Guest) error { + m.guestMap[id] = guest + return nil +} + +func (m MemStore) Update(id int, guest Guest) error { + m.guestMap[id] = guest + return nil +} -- cgit v1.2.3