canonical / sqlair

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

Add support for parsing unicode chars in column names and tags #140

Closed Aflynn50 closed 3 months ago

Aflynn50 commented 4 months ago

The SQLair parser does not currently recognise unicode characters in column names. It also doesn't support a way to select numbers into outputs, or to select column names with quotes into outputs. Adding these features will increase the reliability and polish of SQLair.

The parser is changed to check runes rather than bytes, it also allows for numbers and quoted names to be parsed as column names. The validation for tag names is also changed to include the above so that these columns can be parsed directly into structs.

You will now be able to write SQLair queries such as:

SELECT 世界 AS &S.* FROM t
SELECT 1 AS &M.doesExist FROM t
SELECT "string or column name!" AS $M.quoted FROM t

Also tidied up use of go check in some of the tests, and added tests for lower case structs.

P.S. sorry for the poor commit history, this will all get squashed away.