MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / remove

Method remove

structure/set.go:355–371  ·  view source on GitHub ↗

remove is a method on the FSet struct that takes in a variable number of string parameters. It takes these strings to be "members", and generates errors if any of these strings are not currently present in the FSet. Parameters: member: a variable list of strings that are supposed to be "members"

(member ...string)

Source from the content-addressed store, hash-verified

353// the function immediately returns an ErrInvalidArgs error,
354// which signifies that an invalid argument has been provided to the function.
355func (s *FSets) remove(member ...string) error {
356 if s == nil {
357 return ErrSetNotInitialized
358 }
359 for _, m := range member {
360 // check to see if all members exist
361 if _, exists := (*s)[m]; !exists {
362 return ErrMemberNotFound
363 }
364 }
365 // iterate again
366 for _, m := range member {
367 // remove elements from FSets
368 delete(*s, m)
369 }
370 return nil
371}
372
373// GetSetFromDB retrieves a set from database given a key. If createIfNotExist is true,
374// a new set will be created if the key is not found. It returns the file sets and any write error encountered.

Callers 2

SRemsMethod · 0.80
TestFSets_removeFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestFSets_removeFunction · 0.64