beanquery icon indicating copy to clipboard operation
beanquery copied to clipboard

String formatting ang string concatenation

Open dnicolodi opened this issue 1 year ago • 1 comments

There would be value in adding support for rendering values as strings with some control on the formatting, and for concatenating strings.

Formatting could be done with a format() function resembling the homonymous Python function, or the Python str class method. The latter would allow to format multiple values in one string, with the drawback of a more complex implementation, especially regarding typing in BQL. The former would be much simpler to implement.

String concatenation could be done with the + operator like in Python or with the || like in standard SQL. I like the + better.

dnicolodi avatar Jun 21 '24 20:06 dnicolodi

PostgreSQL has a format(frmt, value, ...) function. Thus maybe this is the way to go for BQL too. https://www.postgresql.org/docs/current/functions-string.html#FUNCTIONS-STRING-FORMAT

dnicolodi avatar Jun 22 '24 13:06 dnicolodi