2

我定义了一个使用 Mito ORM 的类,插槽定义了一个:col-type

(isbn
 :accessor isbn
 :initarg :isbn
 :col-type (or (:varchar 128) :null))

如何获得:col-type定义?由于这是我的类定义中的一个插槽,是否没有通用的方法来访问它,比如slot-definition :col-type ...

clos-mop 文档中,我只找到了如何访问

slot-definition-allocation
slot-definition-initargs
slot-definition-initform
slot-definition-initfunction
slot-definition-name
slot-definition-type

isbn 插槽显示如下:

#<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))

谢谢。

4

1 回答 1

2

是由 提供的col-type扩展mito.class.column:table-column-class。它有一个访问器%table-column-type,由mito.class.column:table-column-type.

于 2018-05-11T10:31:59.193 回答