[postmodern-devel] Patch for with-column-writers?

Curtis Schlak realistschuckle at gmail.com
Tue Oct 27 03:23:48 UTC 2009


I tried multiple ways to get the with-column-writers macro in the
repository to work and could not. I believe that the loop should read
:in rather than :on as follows:


(defmacro with-column-writers ((&rest defs) &body body)
  `(let ((*custom-column-writers* (append (list ,@(loop :for (field
writer) :in defs
                                                        :collect
`(cons (to-sql-name ,field) ,writer)))
                                          *custom-column-writers*)))
    , at body))


With that in place, the following code works correctly:


(defclass foo ()
  ((id :col-type int :initform :id :accessor foo-id)
   (stuff :initform :stuff :accessor foo-stuff))
  (:metaclass postmodern:dao-class)
  (:keys id))

(setf foo
      (postmodern:with-column-writers
        ((:id #'(lambda (inst val)
                  (setf (foo-id inst) val)
                  (setf (foo-stuff inst)
                        (format nil "My Value: ~A" val)))))
  (postmodern:get-dao 'foo 1)))




More information about the postmodern-devel mailing list