Add non-bucket StringListContains

This commit is contained in:
Brian Buller 2024-12-11 16:48:05 -06:00
parent 2ff40dcfdc
commit e31f75cb63

View File

@ -660,6 +660,19 @@ func (b *DB) AddToStringList(path []string, values ...string) error {
return err
}
func (b *DB) StringListContains(path []string, value string) (bool, error) {
list, err := b.GetStringList(path)
if err != nil {
return false, err
}
for i := range list {
if list[i] == value {
return true, nil
}
}
return false, nil
}
// GetKeyValueMap returns a map of all key/value pairs in the bucket at path
func (b *DB) GetKeyValueMap(path []string) (map[string][]byte, error) {
var err error