问题
I define a class which uses the Mito ORM, the slots define a :col-type
:
(isbn
:accessor isbn
:initarg :isbn
:col-type (or (:varchar 128) :null))
How to get the :col-type
definition ? Since this is a slot in my class definition, is there no generic way to access it, like slot-definition :col-type ...
?
On the clos-mop documentation, I only find how to access
slot-definition-allocation
slot-definition-initargs
slot-definition-initform
slot-definition-initfunction
slot-definition-name
slot-definition-type
The isbn slot shows like this:
#<MITO.DAO.COLUMN:DAO-TABLE-COLUMN-CLASS {1005928483}>
--------------------
Name: BOOKSHOPS.MODELS:ISBN
Init args: (:ISBN)
Init form: #<unspecified>
Init function: NIL
--------------------
Group slots by inheritance [ ]
Sort slots alphabetically [X]
All Slots:
[ ] %CLASS = #<DAO-TABLE-CLASS BOOK>
[ ] %DOCUMENTATION = NIL
[ ] %TYPE = T
[ ] ALLOCATION = :INSTANCE
[ ] ALLOCATION-CLASS = NIL
[ ] COL-TYPE = (OR (:VARCHAR 128) :NULL)
[ ] DEFLATE = #<unbound>
[ ] GHOST = NIL
[ ] INFLATE = #<unbound>
[ ] INITARGS = (:ISBN)
[ ] INITFORM = NIL
[ ] INITFUNCTION = NIL
[ ] NAME = BOOKSHOPS.MODELS:ISBN
[ ] PRIMARY-KEY = NIL
[ ] READERS = (BOOKSHOPS.MODELS:ISBN)
[ ] REFERENCES = NIL
[ ] WRITERS = ((SETF BOOKSHOPS.MODELS:ISBN))
Thanks.
回答1:
The col-type
is an extension provided by mito.class.column:table-column-class
. It has an accessor %table-column-type
, which is wrapped by mito.class.column:table-column-type
.
来源:https://stackoverflow.com/questions/50290100/mop-acess-any-slot-definition-mitos-col-type