delete groups
This commit is contained in:
@@ -8,9 +8,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
mu sync.RWMutex
|
||||
CacheUsers = make(map[uuid.UUID]*User)
|
||||
CacheGroups = make(map[uuid.UUID]*Group)
|
||||
mu sync.RWMutex
|
||||
CacheUsers = make(map[uuid.UUID]*User)
|
||||
)
|
||||
|
||||
func CacheGetUserById(id uuid.UUID) (*User, error) {
|
||||
@@ -50,19 +49,6 @@ func CacheDeleteUser(id uuid.UUID) {
|
||||
delete(CacheUsers, id)
|
||||
}
|
||||
|
||||
func CacheSaveGroup(group *Group) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
CacheGroups[group.Id] = group
|
||||
}
|
||||
|
||||
func CacheDeleteGroup(id uuid.UUID) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
delete(CacheGroups, id)
|
||||
}
|
||||
|
||||
func CacheAddConnection(a, b *User, conn *Connection) {
|
||||
first, second := a, b
|
||||
if a.Id.String() > b.Id.String() {
|
||||
@@ -96,14 +82,3 @@ func CacheGetConnection(user *User, id uuid.UUID) (*Connection, bool) {
|
||||
return conn, ok
|
||||
}
|
||||
|
||||
func CacheGetGroup(id uuid.UUID) (*Group, error) {
|
||||
mu.RLock()
|
||||
defer mu.RUnlock()
|
||||
|
||||
group, ok := CacheGroups[id]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("group %s not found", id)
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user