(ql:quickload :postmodern)
(defpackage :test-case
(:use :cl)
(:import :pomo))
(in-package :test-case)
;; (defclass dao-class (standard-class)
;; ((direct-keys :initarg :keys :initform nil :reader direct-keys)
;; (effective-keys :reader dao-keys)
;; (table-name)
;; (column-map :reader dao-column-map))
;; (:documentation "Metaclass for database-access-object classes."))
(defclass definition ()
((id :col-type serial :reader definition-id)
(content :col-type string :initarg :content :accessor definition-content)
(word :col-type string :initarg :word :accessor definition-word))
(:metaclass dao-class)
(:keys id))
(pomo:dao-keys 'definition)
;; => (ID)
;; What I am setting with :keys? a slot in the meta class?
问问题
433 次
1 回答
3
dao-class
有插槽direct-keys
,其:initarg
名为:keys
,因此,如果我正确理解您的问题,答案是:“是的,(:keys id)
提供direct-keys
元类中插槽的值dao-class
。”
编辑更准确地说,在这里,因为措辞不是很清楚......dao-class
是一个元类,即一个类,其实例是类本身。在这种情况下,类 definition
是 的实例,dao-class
它具有插槽direct-keys
(在 中声明dao-class
),并且该插槽的值definition
是从通过:keys
选项提供的值初始化的。
于 2013-06-24T15:18:58.457 回答