Beispiel #1
0
// NewCursor ...
func (db *Database) NewCursor() (cursor *Cursor, err error) {
	cursor = &Cursor{parent: db}
	res := C.unqlite_kv_cursor_init(db.handle, &cursor.handle)
	if res != C.UNQLITE_OK {
		err = UnQLiteError(res)
	}
	runtime.SetFinalizer(cursor, (*Cursor).Close)
	return
}
Beispiel #2
0
func (u *Unqlite) NewCursor() (*Cursor, error) {
	var cur Cursor
	e := C.unqlite_kv_cursor_init(u.db, &(cur.c))
	return &cur, code2Error(e)
}