table Product {
product_id: int
product_name: string
}
// state machine of case
// protect data integrity
function Case() {
var case_id: int
var driver_id: int
var product_id: int
}
// ensure fields sync with same name function
// provide readonly access
table Case {
case_id: int
driver_int: int
product_id: int
}
// view transformation
table DriverSecurityCaseCnt(case: Case, product: Product): {
driver_id: int
@on_change(customBusinessLogic)
case_cnt: int
product_name: string
} => select driver_id, count(*) as case_cnt, product_name from case, product
where product.product_id = case.product_id
group by case.driver_id
language integrated query