The whole code of this example you will be find at Nature_Demo project.
Assume we want to implement an Online-Shop system, and let's start at simple, the processing flow is shown as follow:
This is the first step for manager, Let list what data we wanted.
All this must defined in Nature. otherwise Nature will refuse to accept it. Don't be afraid of the class diagram, you need not to write any code, just fill these goals to Nature DB's table: thing_defines
. I had written the sql for you
sqlite
INSERT INTO thing_defines ("full_key",description,version,states,fields) VALUES
('/B/Sale/Order',NULL,1,NULL,NULL),
('/B/Sale/OrderStatus',NULL,1,'new,payed,stock removing,shipping,finished',NULL),
('/B/Finance/Order/Payment',NULL,1,NULL,NULL),
('/B/Warehouse/ReleaseApplication',NULL,1,NULL,NULL),
('/B/Warehouse/OutboundOrder',NULL,1,NULL,NULL),
('/B/Logistics/DeliverApplication',NULL,1,NULL,NULL),
('/B/Logistics/ReceiptForm',NULL,1,NULL,NULL);
Notice: I used the form "/B/level1/level2/../leveln/yourgoal" for each goal. The "/B" is Thing Type
for Businuss
, this is must be the first part of the full_key
. And the "level1" to "level_n" are used to organize you goals, they are important for a great deal of goals.
Notice: I specified status field for the OrderStatus
goal, it is the only one for this example.
The second step is design path from one goal to another, let's see:
I drew the picture intent to make you understand easily. in actually the data makes up this picture comes from another table: one_step_flow
. Let's see:
```sqlite INSERT INTO onestepflow (fromthing, fromversion, tothing, toversion, settings) VALUES('/B/Sale/Order', 1, '/B/Sale/OrderStatus', 1, '{"executor":[{"protocol":"LocalRust","url":"natureintegratetestconverter.dll:rtnone","proportion":1}]}'), ('/B/multidownstream/from', 1, '/B/multidownstream/toA', 1, '{"executor":[{"protocol":"LocalRust","url":"local://multidownstream","proportion":1}]}'), ('/B/multidownstream/from', 1, '/B/multidownstream/toB', 1, '{"executor":[{"protocol":"LocalRust","url":"local://multidownstream","proportion":1}]}');
```
The from_thing
, from_version
, to_thing
, to_version
represent the arrow's direction on the picture. The settings is little complex. It's a JSON object
Just like the table name, each row only flow one step. and we can connect the rows to the picture above.
When there is a Order
we want to generate an OrderStatus
and marked with new
多个库房的问题
多次中转的问题