本文整理匯總了Golang中C.leveldb_delete函數的典型用法代碼示例。如果您正苦於以下問題:Golang leveldb_delete函數的具體用法?Golang leveldb_delete怎麽用?Golang leveldb_delete使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了leveldb_delete函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Delete
func (db *LevelDB) Delete(key []byte) error {
var err *C.char
C.leveldb_delete(db.db, db.writeOpts.Opts, C.CString(string(key)), C.size_t(len(key)),
&err)
if err != nil {
e := &DBError{}
e.Err = C.GoString(err)
return e
}
return nil
}
示例2: delete
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.leveldb_delete(
db.db, wo.Opt, k, C.size_t(len(key)), &errStr)
if errStr != nil {
return saveError(errStr)
}
return nil
}
示例3: Delete
func (ldb *Db) Delete(key []byte, w_options *Writeoptions) 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_delete(ldb.ldb, w_options.options, key_c, C.size_t(key_len), &db_err)
if db_err != nil {
return ldb_error(C.GoString(db_err))
}
return nil
}
示例4: Delete
// 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.leveldb_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
}
示例5: Delete
func (db *LevelDB) Delete(key string) (err error) {
opt := C.leveldb_writeoptions_create() // write option
defer C.leveldb_free(unsafe.Pointer(opt))
k := C.CString(key) // copy
defer C.leveldb_free(unsafe.Pointer(k))
var cerr *C.char
C.leveldb_delete(db.CLevelDB, opt, k, C.size_t(len(key)), &cerr)
if cerr != nil {
defer C.leveldb_free(unsafe.Pointer(cerr))
return errors.New(C.GoString(cerr))
}
return
}