// Do NOT call Free() on the result *Val func (txn *Txn) GetVal(dbi DBI, key []byte) (*Val, error) { ckey := Wrap(key) defer ckey.Free() var cval Val ret := C.mdb_get(txn.txn, C.MDB_dbi(dbi), (*C.MDB_val)(ckey), (*C.MDB_val)(&cval)) return &cval, errno(ret) }
func (txn *Txn) Get(dbi DBI, key []byte) ([]byte, error) { ckey := &C.MDB_val{mv_size: C.size_t(len(key)), mv_data: unsafe.Pointer(&key[0])} var cval *C.MDB_val ret := C.mdb_get(txn._txn, C.MDB_dbi(dbi), ckey, cval) if ret != SUCCESS { return nil, Errno(ret) } val := C.GoBytes(cval.mv_data, C.int(cval.mv_size)) return val, nil }
func (txn *Txn) GetVal(dbi DBI, key []byte) (Val, error) { ckey := Wrap(key) var cval Val ret := C.mdb_get(txn._txn, C.MDB_dbi(dbi), (*C.MDB_val)(&ckey), (*C.MDB_val)(&cval)) return cval, errno(ret) }