canonical / sqlair

Friendly type mapping for SQL databases
Apache License 2.0
17 stars 8 forks source link

Mixed types output exprs #73

Closed Aflynn50 closed 1 year ago

Aflynn50 commented 1 year ago

In output expressions, we currently only allow a single type after the AS. The type must be followed either by an asterisk or by column names. A mixture of both is not allowed. For example, we allow: * AS &P.* or * AS &P.name, &P.id.

We could allow statements that do have multiple types and mix asterisks where it is unambiguous.

This PR expands the syntax to allow multiple types after the AS as well as mixing of asterisk and non-asterisk fields. For example it would now allow * AS (&Person.id, &Address.*, &Manager.name).

If a field of a struct is filled twice (i.e. in * AS (&P.*, &P.name)) an error will be returned.

This PR includes #72.