set

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is returned when the key not found.
	ErrKeyNotFound = errors.New("key not found")

	// ErrKeyNotExist is returned when the key not exist.
	ErrKeyNotExist = errors.New("key not exist")

	// ErrKeyNotExist is returned when the item received is nil
	ErrItemEmpty = errors.New("item empty")
)

Functions

This section is empty.

Types

type Set

type Set struct {
	M map[string]map[string]struct{}
}

Set represents the Set.

func New

func New() *Set

New returns a newly initialized Set Object that implements the Set.

func (*Set) SAdd

func (s *Set) SAdd(key string, items ...[]byte) error

SAdd adds the specified members to the set stored at key.

func (*Set) SAreMembers

func (s *Set) SAreMembers(key string, items ...[]byte) (bool, error)

SAreMembers Returns if members are members of the set stored at key. For multiple items it returns true only if all of the items exist.

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) SDiff

func (s *Set) SDiff(key1, key2 string) (list [][]byte, err error)

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

func (*Set) SHasKey

func (s *Set) SHasKey(key string) bool

SHasKey returns if has the set at given key.

func (*Set) SInter

func (s *Set) SInter(key1, key2 string) (list [][]byte, err error)

SInter Returns the members of the set resulting from the intersection of all the given sets.

func (*Set) SIsMember

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

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

func (*Set) SMembers

func (s *Set) SMembers(key string) (list [][]byte, err error)

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

func (*Set) SMove

func (s *Set) SMove(key1, key2 string, item []byte) (bool, error)

SMove moves member from the set at source to the set at destination.

func (*Set) SPop

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

SPop removes and returns one or more random elements from the set value store at key.

func (*Set) SRem

func (s *Set) SRem(key string, items ...[]byte) error

SRem removes the specified members from the set stored at key.

func (*Set) SUnion

func (s *Set) SUnion(key1, key2 string) (list [][]byte, err error)

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