func (da *Cedar) PrefixMatch(key []byte, num int) (ids []int) {
	for from, i := 0, 0; i < len(key); i++ {
		to, err := da.Jump(key[i:i+1], from)
		if err != nil {
			break
		}
		if _, err := da.Value(to); err == nil {
			ids = append(ids, to)
			num--
			if num == 0 {
				return
			}
		}
		from = to
	}
	return
}
func (da *Cedar) PrefixMatch(key []byte, num int) (ids []int) {
	for from, i := 0, 0; i < len(key); i++ {
		to, err := da.Jump(key[i:i+1], from)
		if err != nil {
			break
		}
		if _, err := da.Value(to); err == nil {
			ids = append(ids, to)
			num--
			if num == 0 {
				return
			}
		}
		from = to
	}
	return
}
func ( da * Cedar ) PrefixMatch ( key [ ] byte , num int ) ( ids [ ] int ) { for from , i := 0 , 0 ; i < len ( key ) ; i ++ { to , err := da . Jump ( key [ i : i + 1 ] , from ) if err != nil { break } if _ , err := da . Value ( to ) ; err == nil { ids = append ( ids , to ) num -- if num == 0 { return } } from = to } return }
// PrefixMatch returns a list of at most `num` nodes which match the prefix of the key.
// If `num` is 0, it returns all matches.
// For example, if the following keys were inserted:
//	id	key
//	19	abc
//	23	ab
//	37	abcd
// then
//	PrefixMatch([]byte("abc"), 1) = [ 23 ]				// match ["ab"]
//	PrefixMatch([]byte("abcd"), 0) = [ 23, 19, 37]		// match ["ab", "abc", "abcd"]
PrefixMatch returns a list of at most num nodes which match the prefix of the key . If num is 0 it returns all matches . For example if the following keys were inserted : id key 19 abc 23 ab 37 abcd then PrefixMatch ( [] byte ( abc ) 1 ) = [ 23 ] // match [ ab ] PrefixMatch ( [] byte ( abcd ) 0 ) = [ 23 19 37 ] // match [ ab abc abcd ]