-
Notifications
You must be signed in to change notification settings - Fork 27
/
rename.go
28 lines (25 loc) · 638 Bytes
/
rename.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
package main
import "strings"
func renameRate(originalRate string) (name string) {
switch originalRate {
case "m1_rate":
name = "1m"
case "m5_rate":
name = "5m"
case "m15_rate":
name = "15m"
default:
name = strings.TrimSuffix(originalRate, "_rate")
}
return
}
func renameMetric(originalName string) (name string) {
name = strings.ToLower(originalName)
name = strings.Replace(name, ".", "_", -1)
name = strings.Replace(name, "-", "_", -1)
name = strings.Replace(name, "$", "_", -1)
name = strings.Replace(name, "(", "_", -1)
name = strings.Replace(name, ")", "_", -1)
name = strings.TrimRight(name, "_")
return
}