(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?
https://gist.github.com/PuercoPop/5850773
dao-class
有插槽direct-keys
,其:initarg
名为:keys
,因此,如果我正确理解您的问题,答案是:"是的,(:keys id)
为元类dao-class
中的direct-keys
插槽提供了值。
编辑 更准确地说,在这里,由于措辞不太清楚...... dao-class
是一个元类,即一个类,其实例本身就是类。在这种情况下,类 definition
是 dao-class
的一个实例,它具有插槽direct-keys
(在 dao-class
中声明(,并且该插槽的值在 definition
中从通过 :keys
选项提供的值初始化。