Example #1
0
File: txn.go Project: Crest/gomdb
func (txn *Txn) CursorOpen(dbi DBI) (*Cursor, error) {
	var _cursor *C.MDB_cursor
	ret := C.mdb_cursor_open(txn._txn, C.MDB_dbi(dbi), &_cursor)
	if ret != SUCCESS {
		return nil, Errno(ret)
	}
	return &Cursor{_cursor}, nil
}
Example #2
0
func openCursor(txn *Txn, db DBI) (*Cursor, error) {
	c := &Cursor{txn: txn}
	ret := C.mdb_cursor_open(txn._txn, C.MDB_dbi(db), &c._c)
	if ret != success {
		return nil, operrno("mdb_cursor_open", ret)
	}
	return c, nil
}