Ejemplo n.º 1
0
func (w *WriteBatch) commit(wb *WriteOptions) error {
	var errStr *C.char
	C.leveldb_write(w.db.db, wb.Opt, w.wbatch, &errStr)
	if errStr != nil {
		return saveError(errStr)
	}
	return nil
}
Ejemplo n.º 2
0
// Write atomically writes the *WriteBatch to disk.
func (db *DB) Write(wo *WriteOptions, w *WriteBatch) error {
	var errStr *C.char
	C.leveldb_write(db.Ldb, wo.Opt, w.wbatch, &errStr)
	if errStr != nil {
		return DatabaseError(C.GoString(errStr))
	}
	return nil
}
Ejemplo n.º 3
0
// Write atomically writes a WriteBatch to disk.
func (db *DB) Write(wo *WriteOptions, w *WriteBatch) error {
	var errStr *C.char
	C.leveldb_write(db.Ldb, wo.Opt, w.wbatch, &errStr)
	if errStr != nil {
		gs := C.GoString(errStr)
		C.free(unsafe.Pointer(errStr))
		return DatabaseError(gs)
	}
	return nil
}
Ejemplo n.º 4
0
func (ldb *Db) Write(w_options *Writeoptions, batch *Writebatch) error {
	var db_err *C.char

	C.leveldb_write(ldb.ldb, w_options.options, batch.wb, &db_err)
	if db_err != nil {
		return ldb_error(C.GoString(db_err))
	}

	return nil
}