mito icon indicating copy to clipboard operation
mito copied to clipboard

The accessor created by deftable cannot access dao.

Open cxxxr opened this issue 3 years ago • 0 comments

$ createdb mito-example
(ql:quickload :mito)

(mito:deftable parent ()
  ())

(mito:deftable child ()
  ((parent :col-type parent)))

(mito:connect-toplevel :postgres :database-name "mito-example")

(mapc #'mito:execute-sql (mapcan #'mito:table-definition '(parent child)))

(mito:create-dao 'child :parent (mito:create-dao 'parent))

(child-parent (mito:find-dao 'child)) ;; The slot PARENT is unbound in the object

;; Specify the accessor explicitly
(mito:deftable child ()
  ((parent :col-type parent :accessor child-parent)))

(child-parent (mito:find-dao 'child)) ;; => #<PARENT {1005BD41D3}>

cxxxr avatar Mar 06 '21 11:03 cxxxr