func (cursor *Cursor) Get(set_key []byte, op uint) (key, val []byte, err error) { var ckey C.MDB_val var cval C.MDB_val if set_key != nil && op == SET { var cset_key *C.MDB_val cset_key = &C.MDB_val{mv_size: C.size_t(len(set_key)), mv_data: unsafe.Pointer(&set_key[0])} ret := C.mdb_cursor_get(cursor._cursor, cset_key, &cval, C.MDB_cursor_op(op)) if ret != SUCCESS { err = Errno(ret) key = nil val = nil return } key = set_key val = C.GoBytes(cval.mv_data, C.int(cval.mv_size)) } ret := C.mdb_cursor_get(cursor._cursor, &ckey, &cval, C.MDB_cursor_op(op)) if ret != SUCCESS { err = Errno(ret) key = nil val = nil return } err = nil key = C.GoBytes(ckey.mv_data, C.int(ckey.mv_size)) val = C.GoBytes(cval.mv_data, C.int(cval.mv_size)) return }
func (cursor *Cursor) Get(set_key []byte, op uint) (key, val []byte, err error) { var ckey C.MDB_val var cval C.MDB_val if set_key != nil && (op == SET || op == SET_KEY || op == SET_RANGE) { ckey.mv_size = C.size_t(len(set_key)) ckey.mv_data = unsafe.Pointer(&set_key[0]) } ret := C.mdb_cursor_get(cursor._cursor, &ckey, &cval, C.MDB_cursor_op(op)) if ret != SUCCESS { err = Errno(ret) key = nil val = nil return } err = nil key = C.GoBytes(ckey.mv_data, C.int(ckey.mv_size)) val = C.GoBytes(cval.mv_data, C.int(cval.mv_size)) return }
// getVal0 retrieves items from the database without using given key or value // data for reference (Next, First, Last, etc). // // See mdb_cursor_get. func (c *Cursor) getVal0(op uint) error { ret := C.mdb_cursor_get(c._c, c.txn.key, c.txn.val, C.MDB_cursor_op(op)) return operrno("mdb_cursor_get", ret) }
func (cursor *Cursor) GetVal(key, val []byte, op uint) (*Val, *Val, error) { ckey := Wrap(key) cval := Wrap(val) ret := C.mdb_cursor_get(cursor._cursor, (*C.MDB_val)(ckey), (*C.MDB_val)(cval), C.MDB_cursor_op(op)) return ckey, cval, errno(ret) }
func (cursor *Cursor) GetVal(key []byte, op uint) (Val, Val, error) { ckey := Wrap(key) var cval Val ret := C.mdb_cursor_get(cursor._cursor, (*C.MDB_val)(&ckey), (*C.MDB_val)(&cval), C.MDB_cursor_op(op)) return ckey, cval, errno(ret) }