當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.leveldb_delete函數代碼示例

本文整理匯總了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
}
開發者ID:shafreeck,項目名稱:hermes,代碼行數:11,代碼來源:db.go

示例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
}
開發者ID:huanshi,項目名稱:ledisdb,代碼行數:15,代碼來源:db.go

示例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
}
開發者ID:monadbobo,項目名稱:agent_leveldb,代碼行數:16,代碼來源:leveldb.go

示例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
}
開發者ID:olehz,項目名稱:hyperleveldb-go,代碼行數:21,代碼來源:db.go

示例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
}
開發者ID:OktayGardener,項目名稱:Computer-Science-CalPoly,代碼行數:17,代碼來源:leveldb.go


注:本文中的C.leveldb_delete函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。