Function: closql-where-class-in

closql-where-class-in is a byte-compiled function defined in closql.el.

Signature

(closql-where-class-in ARGS &optional DB)

Source Code

;; Defined in ~/.emacs.d/elpa/closql-20260101.1828/closql.el
(defun closql-where-class-in (args &optional db)
  (when (symbolp args)
    (setq args (list args)))
  (cond
    ((vectorp args)
     (unless db
       (error "closql-where-class-in: DB cannot be nil if ARGS is a vector"))
     (let ((class (oref-default db object-class))
           (abbrevs nil))
       (mapc (lambda (arg)
               (let ((str (symbol-name arg)))
                 (unless (string-match "\\`\\(!\\)?\\([^*]+\\)\\(\\*\\)?\\'" str)
                   (error "`closql-where-class-in': invalid type: %s" arg))
                 (let* ((exclude (match-beginning 1))
                        (a (intern (match-string 2 str)))
                        (a (cond ((match-beginning 3)
                                  (closql--list-subabbrevs
                                   (closql--expand-abbrev class a)))
                                 ((not (class-abstract-p
                                        (closql--expand-abbrev class a)))
                                  (list a)))))
                   (setq abbrevs
                         (if exclude
                             (cl-set-difference abbrevs a)
                           (nconc abbrevs a))))))
             args)
       (vconcat abbrevs)))
    ((vconcat
      (mapcar #'closql--abbrev-class
              (mapcan (lambda (sym)
                        (let ((str (symbol-name sym)))
                          (cond ((string-suffix-p "--eieio-childp" str)
                                 (closql--list-subclasses
                                  (intern (substring str 0 -14)) nil))
                                ((string-suffix-p "-p" str)
                                 (list (intern (substring str 0 -2))))
                                ((list sym)))))
                      args))))))