Question

(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

Was it helpful?

Solution

dao-class has the slot direct-keys, whose :initarg is named :keys, so, if I understand your question correctly, the answer ist: "Yes, (:keys id) provides the value for the direct-keys slot in the meta-class dao-class."

EDIT To be more precise, here, since the wording is not quite clear... dao-class is a meta-class, i.e., a class, whose instances are classes themselves. In this case, the class definition is an instance of dao-class, which has the slot direct-keys (declared in dao-class), and the value of that slot in definition is initialized from the value supplied via the :keys option.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top