Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (class +EventOrigin +Entity)
- (dm T @ (put> This 'id (genKey 'id '+EventOrigin)) (pass super))
- (rel id (+Need +Key +Number))
- (rel name (+Idx +String))
- (rel settings (+String))
- # Event is data produced by producer
- (class +Event +Entity)
- (dm T @ (put> This 'id (genKey 'id '+Event)) (pass super))
- (rel id (+Need +Key +Number))
- (rel origin (+Need +Ref +Link) NIL (+EventOrigin))
- (rel createdAt (+Need +Ref +Number))
- (rel content (+Need +Ref +String))
- (de getEventsFromTimeStamp (Origin Timestamp)
- (let (DbOrigin (db 'name '+EventOrigin Origin)
- Events (solve '(@CreatedAt (cons Timestamp T)
- @Origin Origin
- (select (@Event)
- ((createdAt +Event @CreatedAt)
- (origin +Event @Origin))
- (same @Origin @Event DbOrigin)
- (range @CreatedAt @Event createdAt)))))
- (if (not (== DbOrigin NIL))
- Events
- "Wrong event origin")
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement