1 // Copyright (c) 2014, Suryandaru Triandana <syndtr@gmail.com>
2 // All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file.
9 // Range is a key range.
11 // Start of the key range, include in the range.
14 // Limit of the key range, not include in the range.
18 // BytesPrefix returns key range that satisfy the given prefix.
19 // This only applicable for the standard 'bytes comparer'.
20 func BytesPrefix(prefix []byte) *Range {
22 for i := len(prefix) - 1; i >= 0; i-- {
25 limit = make([]byte, i+1)
31 return &Range{prefix, limit}