forked from topfreegames/pitaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
group_service.go
31 lines (28 loc) · 991 Bytes
/
group_service.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
package groups
import (
"context"
"time"
)
type (
// GroupService has ranking methods
GroupService interface {
GroupAddMember(ctx context.Context, groupName, uid string) error
GroupContainsMember(ctx context.Context, groupName, uid string) (bool, error)
GroupCountMembers(ctx context.Context, groupName string) (int, error)
GroupCreate(ctx context.Context, groupName string) error
GroupCreateWithTTL(ctx context.Context, groupName string, ttlTime time.Duration) error
GroupDelete(ctx context.Context, groupName string) error
GroupMembers(ctx context.Context, groupName string) ([]string, error)
GroupRemoveAll(ctx context.Context, groupName string) error
GroupRemoveMember(ctx context.Context, groupName, uid string) error
GroupRenewTTL(ctx context.Context, groupName string) error
}
)
func elementIndex(slice []string, element string) (int, bool) {
for i, sliceElement := range slice {
if element == sliceElement {
return i, true
}
}
return 0, false
}