Beispiel #1
0
func (wb *Writebatch) Delete(key []byte) error {
	var db_err *C.char

	key_len := len(key)
	if key_len == 0 {
		return ldb_error("key must not empty")
	}

	key_c := (*C.char)(unsafe.Pointer(&key[0]))
	C.leveldb_writebatch_delete(wb.wb, key_c, C.size_t(key_len))
	if db_err != nil {
		return ldb_error(C.GoString(db_err))
	}

	return nil
}
Beispiel #2
0
func (w *WriteBatch) Delete(key []byte) {
	C.leveldb_writebatch_delete(w.wbatch,
		(*C.char)(unsafe.Pointer(&key[0])), C.size_t(len(key)))
}