aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/world/service/crud.lux
blob: 00eb870c563e23fc3409e021897610b22f9d7ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(.module:
  [library
   [lux #*
    [control
     ["." try (#+ Try)]
     [security
      ["!" capability (#+ capability:)]]]
    [time
     ["." instant (#+ Instant)]]]])

(type: #export ID Nat)

(type: #export Time
  {#created Instant
   #updated Instant})

(capability: #export (Can_Create ! entity)
  (can_create [Instant entity] (! (Try ID))))

(capability: #export (Can_Retrieve ! entity)
  (can_retrieve ID (! (Try [Time entity]))))

(capability: #export (Can_Update ! entity)
  (can_update [ID Instant entity] (! (Try Any))))

(capability: #export (Can_Delete ! entity)
  (can_delete ID (! (Try Any))))

(type: #export (CRUD ! entity)
  {#can_create (Can_Create ! entity)
   #can_retrieve (Can_Retrieve ! entity)
   #can_update (Can_Update ! entity)
   #can_delete (Can_Delete ! entity)})