cornucopia icon indicating copy to clipboard operation
cornucopia copied to clipboard

allow multiline definition

Open xoac opened this issue 3 years ago • 3 comments

Hi in case of long SELECT with many LEFT JOIN (when joins are optional) definition can be longer It would be nice if such code would be correct:

--: MyType (
--: name1?, name2?, name3?, name4?,
--: name5?, name6?
--: )

xoac avatar Sep 14 '22 10:09 xoac

This would require a parser rework, but could be worthwhile. Its definitely doable in theory, since the old parser used to support this.

Another related question is if we should allow wildcard nullity declarations, like

--: MyType (*)

Where the star * meaning that all fields are declared null.

LouisGariepy avatar Sep 14 '22 19:09 LouisGariepy

For my perspective this looks counter-intuitive. I mean without documentation I couldn't guess that * mean optional. Maybe *? would be better what would be similar to regex.

Truly I would prefer ability to join types and make whole types optional. In case of LEFT JOIN you want the whole structure optional not only fields.

--: MyType (a, b)
--: LeftJoinType(d?, e)
--: JoinedType (MyType, LeftJoinType?). 

But this is complicated to implement as LeftJoinType would require at least one NOT NULL field to be able distinguish null struct from struct with all optional fields.

xoac avatar Sep 15 '22 06:09 xoac

Typescript syntax for optional field (NULLABLE) is ? question mark

I suggest question mark, because it is most intuitive way

ricardodarocha avatar Nov 11 '22 00:11 ricardodarocha