code: func (db *DB) SetBit(key []byte, offset int, on int) (int64, error) {
  	if err := checkKeySize(key); err != nil {
  		return 0, err
  	}
  
  	if (on & ^1) != 0 {
  		return 0, fmt.Errorf("bit must be 0 or 1, not %d", on)
  	}
  
  	t := db.kvBatch
  
  	t.Lock()
  	defer t.Unlock()
  
  	key = db.encodeKVKey(key)
  	value, err := db.bucket.Get(key)
  	if err != nil {
  		return 0, err
  	}
  
  	byteOffset := int(uint32(offset) >> 3)
  	extra := byteOffset + 1 - len(value)
  	if extra > 0 {
  		value = append(value, make([]byte, extra)...)
  	}
  
  	byteVal := value[byteOffset]
  	bit := 7 - uint8(uint32(offset)&0x7)
  	bitVal := byteVal & (1 << bit)
  
  	byteVal &= ^(1 << bit)
  	byteVal |= (uint8(on&0x1) << bit)
  
  	value[byteOffset] = byteVal
  
  	t.Put(key, value)
  	if err := t.Commit(); err != nil {
  		return 0, err
  	}
  
  	if bitVal > 0 {
  		return 1, nil
  	}
  
  	return 0, nil
  }
docs: // SetBit sets the bit to the data.