bomberpac/waltz/sqltest.fnl

14 lines
497 B
Fennel

(local Sqlog (require :waltz.sqlog))
(import-macros {: $ : query : insert : delete : update : defrules} :waltz.macros)
(local s (Sqlog))
(s:deftable :parent :parent :child)
(s:deftable :p :x :y)
(s:deftable :q :z)
(defrules s
([generation name (|| name " jr") 2] [parent name (|| name " jr")])
([generation name (|| name " iii") 3] [ancestor name (|| name " iii")])
([ancestor x y 1] [parent x y])
([ancestor x y (+ gen 1)] [parent x z] [ancestor z y gen]))
(pp (delete s [p 1 x] [q x]))