Skip to content

Commit

Permalink
Rename fetch-dao to fetch-dao-from-cursor and unexport it.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Aug 7, 2024
1 parent c0100e1 commit e319e62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/core/dao.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
#:delete-by-values
#:save-dao
#:select-dao
#:*want-cursor*
#:fetch-dao
#:select-by-sql
#:includes
#:include-foreign-objects
Expand Down Expand Up @@ -216,8 +214,7 @@
(make-mito-cursor :cursor cursor
:class class))))

(defun fetch-dao (cursor)
(check-type cursor mito-cursor)
(defun fetch-dao-from-cursor (cursor)
(let ((row (dbi:fetch (mito-cursor-cursor cursor)
:format :alist)))
(when row
Expand Down Expand Up @@ -456,7 +453,7 @@
(let* ((*want-cursor* t)
(,cursor ,select))
(loop ,@(and index `(for ,index from 0))
for ,dao = (fetch-dao ,cursor)
for ,dao = (fetch-dao-from-cursor ,cursor)
while ,dao
do (progn ,@body)))))
(if (dbi:in-transaction *connection*)
Expand Down
6 changes: 3 additions & 3 deletions t/dao.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@
(cursor (mito.dao:select-dao 'user
(where (:like :name "%aro")))))
(ok (typep cursor 'mito.dao::mito-cursor))
(let ((row (mito.dao:fetch-dao cursor)))
(let ((row (mito.dao::fetch-dao-from-cursor cursor)))
(ok (typep row 'user))
(ok (equal (slot-value row 'name) "Eitaro")))
(let ((row (mito.dao:fetch-dao cursor)))
(let ((row (mito.dao::fetch-dao-from-cursor cursor)))
(ok (typep row 'user))
(ok (equal (slot-value row 'name) "Btaro")))
(ok (null (mito.dao:fetch-dao cursor)))))
(ok (null (mito.dao::fetch-dao-from-cursor cursor)))))

(let ((records '()))
(do-cursor (dao (mito.dao:select-dao 'user) i)
Expand Down

0 comments on commit e319e62

Please sign in to comment.