expr-json-spec Pub

Json

$when:: expr.json.create (customer)
   . (cart=(cart || {id:customer,items:[]}))

$when:: expr.json.addItem (sku, quantity)
   . (cart=(cart + {items:{sku:sku,quantity:quantity}}))

$when:: testing.invcheck
   . (payload="ok")

$when:: expr.json.create2 (a, b)
   ctx.json (a<-a, b<-b)

$when:: expr.json.sum2 (a, b)
   ctx.json (a<-a)
   . (aj=payload)
   ctx.json (b<-b)
   . (bj=payload)
   . (payload=(aj + bj))

/$when shipping.package /=> cart/items $map item => inv.get (item.sku,item.quantity})

Test numbers

$when:: expr.simplejson.do (x)
   ctx.json (x<-x)

Calling with flatenning

$when:: dieseltest.asAttrs (a, b)
   . (res33=(a + b))

Complex objects

list | new
class::DieselTestStudent (    name,     address:DieselTestAddress,     name,     address:DieselTestAddress)
list | new
class::DieselTestAddress (    street,     no,     street,     no)

$when:: test.diesel.rule40
   . (student[="address"][="no"]="65")

Array ops

$when:: test.diesel.isin (x in ["123","234"], y not in [1,2])
   . (y46=true)


Was this useful?    

By: Razie | 2019-06-10 | Tags: spec , dsl


Viewed 64 times ( | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2020, all rights reserved.