Advertisement
Guest User

Untitled

a guest
Nov 17th, 2021
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.11 KB | None | 0 0
  1. (class +EventOrigin +Entity)
  2. (dm T @ (put> This 'id (genKey 'id '+EventOrigin)) (pass super))
  3. (rel id (+Need +Key +Number))
  4. (rel name (+Idx +String))
  5. (rel settings (+String))
  6.  
  7. # Event is data produced by producer
  8. (class +Event +Entity)
  9. (dm T @ (put> This 'id (genKey 'id '+Event)) (pass super))
  10. (rel id (+Need +Key +Number))
  11. (rel origin (+Need +Ref +Link) NIL (+EventOrigin))
  12. (rel createdAt (+Need +Ref +Number))
  13. (rel content (+Need +Ref +String))
  14.  
  15. (de getEventsFromTimeStamp (Origin Timestamp)
  16.     (let (DbOrigin (db 'name '+EventOrigin Origin)
  17.                    Events (solve '(@CreatedAt (cons Timestamp T)
  18.                                    @Origin Origin
  19.                                    (select (@Event)
  20.                                            ((createdAt +Event @CreatedAt)
  21.                                             (origin +Event @Origin))
  22.                                            (same @Origin @Event DbOrigin)
  23.                                            (range @CreatedAt @Event createdAt)))))
  24.       (if (not (== DbOrigin NIL))
  25.           Events
  26.         "Wrong event origin")
  27.       ))
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement