Skip to content

Add @empty modifier to workflow steps #592

@fractlrao

Description

@fractlrao

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions