GetGroupMembersSnapshot returns group members with snapshot reads (with cache). groupName format is "groups/{identifier}" where identifier can be an email or an ID. Trades consistency for performance.
(ctx context.Context, workspaceID string, groupName string)
| 391 | // groupName format is "groups/{identifier}" where identifier can be an email or an ID. |
| 392 | // Trades consistency for performance. |
| 393 | func (s *Store) GetGroupMembersSnapshot(ctx context.Context, workspaceID string, groupName string) (map[string]bool, error) { |
| 394 | cacheKey := getGroupMembersCacheKey(workspaceID, groupName) |
| 395 | if v, ok := s.groupMembersCache.Get(cacheKey); ok { |
| 396 | return v, nil |
| 397 | } |
| 398 | |
| 399 | group, err := s.GetGroupByName(ctx, workspaceID, groupName) |
| 400 | if err != nil { |
| 401 | return nil, err |
| 402 | } |
| 403 | if group == nil { |
| 404 | return nil, nil |
| 405 | } |
| 406 | |
| 407 | members := make(map[string]bool) |
| 408 | for _, m := range group.Payload.GetMembers() { |
| 409 | members[m.Member] = true |
| 410 | } |
| 411 | s.groupMembersCache.Add(cacheKey, members) |
| 412 | return members, nil |
| 413 | } |
| 414 | |
| 415 | func GetListGroupFilter(find *FindGroupMessage, filter string) (*qb.Query, error) { |
| 416 | if filter == "" { |
no test coverage detected