Fix errors about unknown types

This commit is contained in:
contrapunctus 2022-04-14 12:34:28 +05:30
parent 38e4997269
commit 1465f5da33
1 changed files with 8 additions and 5 deletions

View File

@ -1018,6 +1018,7 @@ Return non-nil if record is inserted successfully.
PLIST may be an interval which crosses days."))
#+(or)
(defmethod insert :before ((_backend t) plist &key &allow-other-keys)
(unless (typep plist 'plist)
(error "Not a valid plist: %S" plist)))
@ -1749,7 +1750,7 @@ Situations -
(defmethod insert ((backend plist-group-backend) plist
&key (save t)
&allow-other-keys)
(check-type plist plist)
;; (check-type plist plist)
(debug-message "[Method] insert: %S" plist)
(backend-run-assertions backend)
(if (not plist)
@ -2051,7 +2052,7 @@ We apply the same hack as in the [[hack-note-plist-group-insert][insert]] method
#+BEGIN_SRC lisp
(defmethod chronometrist:replace-last
((backend plist-group-backend) plist &key &allow-other-keys)
(check-type plist plist)
;; (check-type plist plist)
(when (backend-empty-p backend)
(error "No record to replace in %s" (eieio-object-class-name backend)))
(sexp-in-file (chronometrist:backend-file backend)
@ -2072,7 +2073,7 @@ We apply the same hack as in the [[hack-note-plist-group-insert][insert]] method
#+BEGIN_SRC lisp
(in-package :cl)
(defpackage :chronometrist.sqlite
(:use :cl :trivia)
(:use :cl)
(:import-from :alexandria :hash-table-keys)
(:import-from :local-time :parse-timestring :timestamp-to-unix)
(:import-from :sqlite
@ -2084,6 +2085,7 @@ We apply the same hack as in the [[hack-note-plist-group-insert][insert]] method
:insert-into
:select := :set= :from :order-by)
(:import-from :alexandria :flatten)
(:import-from :trivia :let-match :let-match* :plist)
(:export :sqlite-backend
;; customizable variables
))
@ -2236,7 +2238,7 @@ Properties are key-values excluding :name, :start, and :stop.
Insert nothing if the properties already exist. Return the
prop-id of the inserted or existing property."
(with-slots (connection) backend
(let* ((plist (plist-key-values plist))
(let* ((plist (chronometrist:plist-key-values plist))
(encoded-properties
(if (functionp *sqlite-properties-function*)
(funcall *sqlite-properties-function* plist)
@ -2283,7 +2285,8 @@ s-expressions in a text column.")
#+BEGIN_SRC lisp
(defmethod chronometrist:insert
((backend sqlite-backend) plist &key &allow-other-keys)
(let-match (((or (list plist-1 plist-2) nil) (chronometrist:split-plist plist))
(let-match (((or (list plist-1 plist-2) nil)
(chronometrist:split-plist plist))
(connection (backend-connection backend)))
(loop
for plist in (if (and plist-1 plist-2)