init {
db := {
"accountAndBooks": {
"url": "jdbc:postgresql://localhost:5432/postgres",
"user": "root",
"password": "pass",
"tables": {
"accounts": {
"record": nil
},
"books": {
"record": nil
}
}
}
}
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}.record(curRecord, setRecord(newRecord)) = 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
}