This repository has been archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
paths.go
55 lines (42 loc) · 1.44 KB
/
paths.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
package kvsession
import (
"strings"
)
const pathSeparator = "/"
func pathSession(name string) []byte {
return []byte(strings.Join([]string{"s", name}, pathSeparator))
}
func pathSessions() []byte {
return []byte("s")
}
func pathSessionParticipant(session, username string) []byte {
return []byte(strings.Join([]string{"p", session, username}, pathSeparator))
}
func pathSessionPlan(session string) []byte {
return []byte(strings.Join([]string{session, "plan"}, pathSeparator))
}
func pathSessionTestcases(session string) []byte {
return []byte(strings.Join([]string{session, "case"}, pathSeparator))
}
func pathSessionTestcase(session, tc string) []byte {
return []byte(strings.Join([]string{session, "case", tc}, pathSeparator))
}
func pathSessionClaims(session, tc string) []byte {
return []byte(strings.Join([]string{session, "claim", tc}, pathSeparator))
}
func pathSessionClaim(session, tc, user string) []byte {
return []byte(strings.Join([]string{session, "claim", tc, user}, pathSeparator))
}
func pathSessionContributions(session, tc string) []byte {
return []byte(strings.Join([]string{session, "contrib", tc}, pathSeparator))
}
func pathSessionContribution(session, tc, user string) []byte {
return []byte(strings.Join([]string{session, "contrib", tc, user}, pathSeparator))
}
func getLastSegment(p []byte) string {
if len(p) == 0 {
return ""
}
segments := strings.Split(string(p), pathSeparator)
return segments[len(segments)-1]
}