MOP:可以定义任何插槽吗? (mito的col-type) [英] MOP: acess any slot definition ? (mito's col-type)

查看:84
本文介绍了MOP:可以定义任何插槽吗? (mito的col-type)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

如何获取:col-type 的定义?由于这是我的类定义中的插槽,因此没有通用的访问方式,例如 slot-definition:col-type ... 吗?

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 ... ?

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

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

isbn插槽显示如下:

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

谢谢。

推荐答案

col类型 mito.class.column:table-column-class 提供的扩展。它具有访问器%table-column-type ,该访问器由 mito.class.column:table-column-type

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.

这篇关于MOP:可以定义任何插槽吗? (mito的col-type)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆