set

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record map[string]map[string]struct{}

Record saves set records.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set defines the structure of set.

func New

func New() *Set

New creates a new set data structure.

func (*Set) SAdd

func (s *Set) SAdd(key string, member []byte) int

SAdd adds the specified members to the set stored at key. Specified members that ar already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

func (*Set) SCard

func (s *Set) SCard(key string) int

SCard returns the set cardinality (number of elements) of the set stored at key.

func (*Set) SClear

func (s *Set) SClear(key string)

SClear clears the specified key in set

func (*Set) SDiff

func (s *Set) SDiff(keys ...string) (val [][]byte)

SDiff returns the members of the set resulting from the difference between the first set and all the successive sets.

func (*Set) SIsMember

func (s *Set) SIsMember(key string, member []byte) bool

SIsMember returns if member is a member of the set stored at key.

func (*Set) SKeyExists

func (s *Set) SKeyExists(key string) (ok bool)

SKeyExists returns if the key exists.

func (*Set) SMembers

func (s *Set) SMembers(key string) (val [][]byte)

SMembers returns all the members of the set value stored at key.

func (*Set) SMove

func (s *Set) SMove(src, dst string, member []byte) bool

SMove moves member from the set at source to the set at destination. If the source set does not exist or does not contain the specified element, no operation is performed and return false.

func (*Set) SPop

func (s *Set) SPop(key string, count int) [][]byte

SPop removes and returns one or more random members from the set value stored at key.

func (*Set) SRandMember

func (s *Set) SRandMember(key string, count int) [][]byte

SRandMember when called with just the key argument, returns a random element from the set valued stored at key.

func (*Set) SRem

func (s *Set) SRem(key string, member []byte) bool

SRem removes the specified members from the set stored at key. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns false.

func (*Set) SUnion

func (s *Set) SUnion(keys ...string) (val [][]byte)

SUnion returns the members of the set resulting from the union of all the given sets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL