Add helper functions to models package
This commit is contained in:
parent
6f997c7bf0
commit
83a236d0da
1 changed files with 10 additions and 0 deletions
10
src/models/helpers.lisp
Normal file
10
src/models/helpers.lisp
Normal file
|
@ -0,0 +1,10 @@
|
|||
;;; -*- mode: lisp; coding: utf-8; -*-
|
||||
|
||||
(in-package :ml-survey/models)
|
||||
|
||||
(defun object-to-plist (obj)
|
||||
(loop :for slot :in (closer-mop:class-slots (class-of obj))
|
||||
:for slot-name = (closer-mop:slot-definition-name slot)
|
||||
:when (slot-boundp obj slot-name)
|
||||
:nconc (list (intern (symbol-name slot-name) :keyword)
|
||||
(slot-value obj slot-name))))
|
Loading…
Add table
Reference in a new issue