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

Method Keys

structure/list.go:437–460  ·  view source on GitHub ↗

Keys returns all the keys of the list structure.

(regx string)

Source from the content-addressed store, hash-verified

435
436// Keys returns all the keys of the list structure.
437func (l *ListStructure) Keys(regx string) ([]string, error) {
438 toRegexp := convertToRegexp(regx)
439 compile, err := regexp.Compile(toRegexp)
440 if err != nil {
441 return nil, err
442 }
443 var keys []string
444 byteKeys := l.db.GetListKeys()
445 for _, key := range byteKeys {
446 // match prefix and key
447 if compile.MatchString(string(key)) {
448 // check if deleted
449 db, _, err := l.getListFromDB(string(key), true)
450 if err != nil {
451 continue
452 }
453 if db.Length == 0 {
454 continue
455 }
456 keys = append(keys, string(key))
457 }
458 }
459 return keys, nil
460}
461
462// RPOPLPUSH removes the last element from one list and pushes it to another list.
463// If the source list is empty, an error is returned.

Callers

nothing calls this directly

Calls 3

getListFromDBMethod · 0.95
convertToRegexpFunction · 0.85
GetListKeysMethod · 0.80

Tested by

no test coverage detected