You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
This has come up various times on Slack, noting here for posterity (and so it can be referenced)
The name must() was also thrown into the 🚲 shed.
Is your feature request related to a problem? Please describe.
Sometimes it is necessary to declare arbitrary constraints on a field.
Taking one such example from Slack, where we try to define #Foo as a string that must contain a numeric value greater than 5:
#Foo: constrain(strconv.Atoi(#Foo) > 5)
Describe the solution you'd like
As above.
Describe alternatives you've considered
The current alternative is to declare additional (hidden) definitions that express the constraint:
#Foo: string
_#checkFoo: strconv.Atoi(#Foo) & >5
Contrast the proposed constrain() builtin which allows the constraint to be declared on the field itself, which is much clearer for the author, reader and user.