SInter Returns the members of the set resulting from the intersection of all the given sets.
(key1, key2 string)
| 132 | |
| 133 | // SInter Returns the members of the set resulting from the intersection of all the given sets. |
| 134 | func (s *Set) SInter(key1, key2 string) ([]*core.Record, error) { |
| 135 | if !s.SHasKey(key1) || !s.SHasKey(key2) { |
| 136 | return nil, ErrSetNotExist |
| 137 | } |
| 138 | |
| 139 | records := make([]*core.Record, 0) |
| 140 | |
| 141 | for hash, record := range s.M[key1] { |
| 142 | if _, ok := s.M[key2][hash]; ok { |
| 143 | records = append(records, record) |
| 144 | } |
| 145 | } |
| 146 | return records, nil |
| 147 | } |
| 148 | |
| 149 | // SIsMember Returns if member is a member of the set stored at key. |
| 150 | func (s *Set) SIsMember(key string, value []byte) (bool, error) { |