Ejemplo n.º 1
0
// GetError() returns an error from LevelDB found while iterating.
//
// This method is safe to call when Valid() returns false.
func (it *Iterator) GetError() error {
	var errStr *C.char
	C.leveldb_iter_get_error(it.Iter, &errStr)
	if errStr != nil {
		return IteratorError(C.GoString(errStr))
	}
	return nil
}
Ejemplo n.º 2
0
// GetError returns an IteratorError from LevelDB if it had one during
// iteration.
//
// This method is safe to call when Valid returns false.
func (it *Iterator) GetError() error {
	var errStr *C.char
	C.leveldb_iter_get_error(it.Iter, &errStr)
	if errStr != nil {
		gs := C.GoString(errStr)
		C.free(unsafe.Pointer(errStr))
		return IteratorError(gs)
	}
	return nil
}