-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplerresultMethods.go
58 lines (44 loc) · 1.12 KB
/
simplerresultMethods.go
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package goresult
func SimpleCreate(success bool, messages []Message) SimpleResult {
return SimpleResult{
Success: success,
Messages: messages,
}
}
func SimpleSuccess() SimpleResult {
return SimpleResult{
Success: true,
}
}
func SimpleSuccessWithMessage(message string) SimpleResult {
result := SimpleResult{
Success: true,
}
newMessage := CreateMessage(MessageTypeSuccess, message)
result.Messages = append(result.Messages, newMessage)
return result
}
func SimpleError(message string) SimpleResult {
result := SimpleResult{
Success: false,
}
newMessage := CreateMessage(MessageTypeError, message)
result.Messages = append(result.Messages, newMessage)
return result
}
func SimpleInfo(message string) SimpleResult {
result := SimpleResult{
Success: true,
}
newMessage := CreateMessage(MessageTypeInfo, message)
result.Messages = append(result.Messages, newMessage)
return result
}
func SimpleWarning(message string) SimpleResult {
result := SimpleResult{
Success: true,
}
newMessage := CreateMessage(MessageTypeWarning, message)
result.Messages = append(result.Messages, newMessage)
return result
}