A common pattern is applications is below:
{ScalarSetting {SettingKey? "planning_week_weights"}} @as [PlanningWeightsSetting]
if (PlanningWeightsSetting.length == 0) {
helper.getDefaultPlanningWeekWeights() @as defaultPlanningWeights
{ScalarSetting {
SettingKey "planning_week_weights"
SettingValue defaultPlanningWeights
}}
{ScalarSetting {SettingKey? "planning_week_weights"}} @as [PlanningWeightsSetting]
}
helper.resolvePlanningWeekWeights(PlanningWeightsSetting) @as planningWeekWeights
This is verbose and not declarative. Proposing the following (syntactic sugar over @catch {not_found ...}):
{ScalarSetting {SettingKey? "planning_week_weights"}}
@empty {ScalarSetting {SettingKey? "default"}}
@as [PlanningWeightsSetting]
The @empty pattern gets evaluated when the query returns an empty result.
A common pattern is applications is below:
This is verbose and not declarative. Proposing the following (syntactic sugar over
@catch {not_found ...}):The @empty pattern gets evaluated when the query returns an empty result.