template.go
935 字节
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package core
import (
"github.com/google/uuid"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
)
func NewDomainParagraph(item types.Paragraph) domain.Paragraph {
id := item.ID
if item.ID == "" {
idGen, _ := uuid.NewUUID()
id = idGen.String()
}
return domain.Paragraph{
ID: id,
Title: item.Title,
Prompt: item.Prompt,
Required: item.Required,
Type: item.Type,
}
}
func NewTypesParagraph(item domain.Paragraph) types.Paragraph {
return types.Paragraph{
ID: item.ID,
Title: item.Title,
Prompt: item.Prompt,
Required: item.Required,
Type: item.Type,
}
}
func NewNoneTypesParagraph(item string) types.Paragraph {
return types.Paragraph{
ID: "",
Title: "",
Prompt: "",
Required: false,
Type: 0,
Text: item,
}
}