GetBits function retrieves the bits for the provided key
(k string)
| 130 | |
| 131 | // GetBits function retrieves the bits for the provided key |
| 132 | func (b *BitmapStructure) GetBits(k string) (*BitSet, error) { |
| 133 | // Convert the key to bytes |
| 134 | key := stringToBytesWithKey(k) |
| 135 | // Get the bits from the database |
| 136 | value, err := b.db.Get(key) |
| 137 | if err != nil { |
| 138 | return nil, err |
| 139 | } |
| 140 | // Create a new bitset from the retrieved bits |
| 141 | bit, err := newBitSet(value) |
| 142 | if err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | // Return the bitset |
| 146 | return bit, nil |
| 147 | } |
| 148 | |
| 149 | // GetBit function retrieves a bit at the specified offset in the bitmap for the provided key |
| 150 | func (b *BitmapStructure) GetBit(k string, off uint) (bool, error) { |