-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtopic.go
More file actions
35 lines (30 loc) · 753 Bytes
/
topic.go
File metadata and controls
35 lines (30 loc) · 753 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
28
29
30
31
32
33
34
35
package workflow
import (
"strconv"
"strings"
)
const (
topicSeparator = "-"
emptySpaceReplacement = "_"
)
func Topic(workflowName string, statusType int) string {
name := strings.ReplaceAll(workflowName, " ", emptySpaceReplacement)
return strings.Join([]string{
name,
strconv.FormatInt(int64(statusType), 10),
}, topicSeparator)
}
func DeleteTopic(workflowName string) string {
name := strings.ReplaceAll(workflowName, " ", emptySpaceReplacement)
return strings.Join([]string{
name,
"delete",
}, topicSeparator)
}
func RunStateChangeTopic(workflowName string) string {
name := strings.ReplaceAll(workflowName, " ", emptySpaceReplacement)
return strings.Join([]string{
name,
"run-state-change",
}, topicSeparator)
}