示例#1
0
// Delete ...
func (db *Database) Delete(key []byte) (err error) {
	res := C.unqlite_kv_delete(db.handle, unsafe.Pointer(&key[0]), C.int(len(key)))
	if res != C.UNQLITE_OK {
		err = UnQLiteError(res)
	}
	return
}
示例#2
0
// Delete removes a key-value pair from the database.
func (h *Handle) Delete(key []byte) error {
	rv := C.unqlite_kv_delete(h.db, unsafe.Pointer(&key[0]), C.int(len(key)))
	if rv != C.UNQLITE_OK {
		return Errno(rv)
	}
	return nil
}
示例#3
0
// KvDelete remove a particular record from the database, you can use this high-level thread-safe routine to perform the deletion.
// See: http://unqlite.org/c_api/unqlite_kv_delete.html
func (u *Unqlite) KvDelete(key []byte) error {
	if rc := C.unqlite_kv_delete(u.db, unsafe.Pointer(&key[0]), C.int(len(key))); rc != C.UNQLITE_OK {
		return ErrCode(rc)
	}

	return nil
}
示例#4
0
func (u *Unqlite) KvDelete(key []byte) error {
	var k unsafe.Pointer
	if len(key) > 0 {
		k = unsafe.Pointer(&key[0])
	}
	e := C.unqlite_kv_delete(u.db, k, C.int(len(key)))
	return code2Error(e)
}