GetBit Get the value of the bit at the specified offset in the bitmap If the key does not exist, it returns an error
(key string, offset uint)
| 102 | // GetBit Get the value of the bit at the specified offset in the bitmap |
| 103 | // If the key does not exist, it returns an error |
| 104 | func (b *BitMapStructure) GetBit(key string, offset uint) (bool, error) { |
| 105 | bitmap, length, err := b.getBitmapFromDB(key, false) |
| 106 | if err != nil { |
| 107 | return false, err |
| 108 | } |
| 109 | |
| 110 | // If the offset is out of range, default value is false |
| 111 | if offset >= length { |
| 112 | return false, nil |
| 113 | } |
| 114 | |
| 115 | return b.getBit(bitmap, offset), nil |
| 116 | } |
| 117 | |
| 118 | // GetBits Get the values of a group of bits at the specified offsets in the bitmap |
| 119 | // If the key does not exist, it returns an error |