forked from tomkdickinson/serverless-hexagonal-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpayload.go
More file actions
27 lines (23 loc) · 673 Bytes
/
payload.go
File metadata and controls
27 lines (23 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package lambda
import "github.com/tomkdickinson/serverless-hexagonal-go/internal/blog"
type EntryPayload struct {
Title string `json:"title"`
Slug string `json:"slug"`
Content string `json:"content"`
Author string `json:"author"`
}
func newEntryPayload(domainEntry blog.Entry) EntryPayload {
return EntryPayload{
Title: domainEntry.Title,
Slug: domainEntry.Slug,
Content: domainEntry.Content,
Author: domainEntry.Author,
}
}
func multipleEntries(domainEntries []blog.Entry) []EntryPayload {
var entries []EntryPayload
for _, domainEntry := range domainEntries {
entries = append(entries, newEntryPayload(domainEntry))
}
return entries
}