// Delete removes the data associated with the key from the database. func (db *DB) Delete(opts *WriteOptions, key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_delete(db.c, opts.c, cKey, C.size_t(len(key)), &cErr) return convertErr(cErr) }
// Delete removes the data associated with the key from the database. func (db *DB) Delete(opts *WriteOptions, key []byte) error { var ( cErr *C.char cKey = byteToChar(key) ) C.rocksdb_delete(db.c, opts.c, cKey, C.size_t(len(key)), &cErr) if cErr != nil { defer C.free(unsafe.Pointer(cErr)) return errors.New(C.GoString(cErr)) } return nil }
// del removes the item from the db with the given key. func (r *RocksDB) del(key Key) error { var cErr *C.char C.rocksdb_delete( r.rdb, r.wOpts, (*C.char)(unsafe.Pointer(&key[0])), C.size_t(len(key)), &cErr) if cErr != nil { return charToErr(cErr) } return nil }
func (db *DB) delete(wo *WriteOptions, key []byte) error { var errStr *C.char var k *C.char if len(key) != 0 { k = (*C.char)(unsafe.Pointer(&key[0])) } C.rocksdb_delete( db.db, wo.Opt, k, C.size_t(len(key)), &errStr) if errStr != nil { return saveError(errStr) } return nil }
func (db *DB) Del(rawKey []byte, wb *WriteBatch) error { var ck = (*C.char)(unsafe.Pointer(&rawKey[0])) if wb == nil { var errStr *C.char C.rocksdb_delete(db.db, db.wOpt, ck, C.size_t(len(rawKey)), &errStr) if errStr != nil { defer C.free(unsafe.Pointer(errStr)) return errors.New(C.GoString(errStr)) } } else { C.rocksdb_writebatch_delete(wb.batch, ck, C.size_t(len(rawKey))) } return nil }
// Clear removes the item from the db with the given key. func (r *RocksDB) Clear(key Key) error { if len(key) == 0 { return emptyKeyError() } var cErr *C.char C.rocksdb_delete( r.rdb, r.wOpts, bytesPointer(key), C.size_t(len(key)), &cErr) if cErr != nil { return charToErr(cErr) } return nil }
// Delete removes the data associated with the key from the database. // // The key byte slice may be reused safely. Delete takes a copy of // them before returning. func (db *DB) Delete(wo *WriteOptions, key []byte) error { var errStr *C.char var k *C.char if len(key) != 0 { k = (*C.char)(unsafe.Pointer(&key[0])) } C.rocksdb_delete( db.Ldb, wo.Opt, k, C.size_t(len(key)), &errStr) if errStr != nil { gs := C.GoString(errStr) C.free(unsafe.Pointer(errStr)) return DatabaseError(gs) } return nil }