diff --git a/AlgebraicDataflowArchitectureModel/models/DatabaseTest2.model b/AlgebraicDataflowArchitectureModel/models/DatabaseTest2.model new file mode 100644 index 0000000..5d5cc98 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/DatabaseTest2.model @@ -0,0 +1,47 @@ +init { + db := { + "accountAndBooks": { + "url": "jdbc:postgresql://localhost:5432/db", + "user": "root", + "password": "pass", + "tables": { + "accounts": { + "0": { + "name": "tmp" + } + }, + "books": { + "0": { + "name": "tmp" + } + } + } + } + } + current:= { + "aid": { + "value": 0, + "dbName": "accountAndBooks", + "table": "accounts", + "key": "aid" + }, + "bid": { + "value": 0, + "dbName": "accountAndBooks", + "table": "books", + "key": "bid" + } + } +} + +native channel setRecord(dbName: Str, tableName: Str) { + out db.{dbName}.tables.{tableName}(curRecord: Json, setRecord(newRecord: Json)) = newRecord +} + +native channel updateRecordOnChangeCurrent(varName: Str) { + in current.{varName}.value(currentData, updateRecord(newCurrentData)) = newCurrentData +} + +channel updateCurrent(varName: Str) { + out current.{varName}.value(curValue: Int, setValue(newValue: Int)) = newValue +} \ No newline at end of file