MOP: acess any slot definition ? (mito's col-type)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 01:38:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!