diff options
author | Michael Hunteman <michael@huntm.net> | 2024-05-17 15:20:30 -0700 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-05-17 15:20:30 -0700 |
commit | 7103019890960e793deefb64987a09b33be60b42 (patch) | |
tree | c1c9402aa250c68b2cbe13d62598232bbf20b1e2 /server/guests | |
parent | fc5c111bcfe296bec82e1cf9fdb88fc80fb24f89 (diff) |
Add golang server
Diffstat (limited to 'server/guests')
-rw-r--r-- | server/guests/models.go | 17 | ||||
-rw-r--r-- | server/guests/store.go | 26 |
2 files changed, 43 insertions, 0 deletions
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 +} |