setBitmapToDB stores the data into the database.
(key string, bm []byte, length uint)
| 376 | |
| 377 | // setBitmapToDB stores the data into the database. |
| 378 | func (b *BitMapStructure) setBitmapToDB(key string, bm []byte, length uint) error { |
| 379 | // Serialize into a binary array |
| 380 | encValue, err := b.encodeBitmap(bm, length) |
| 381 | if err != nil { |
| 382 | return err |
| 383 | } |
| 384 | // Store in the database |
| 385 | return b.db.Put([]byte(key), encValue) |
| 386 | } |
| 387 | |
| 388 | // encodeBitmap encodes the value |
| 389 | // format: [type][length][value] |