sql-bricks-postgres
sql-bricks-postgres copied to clipboard
fix converts.Array
for https://github.com/CSNW/sql-bricks/issues/98
There should be a better solution. This breaks for non int, non text arrays. Also, what's your use case? Why can't you type cast in SQL?
I can't use type cast in SQL because inline SQL used as a template for many types (in JavaScript understand Number or String, as BIGINT or TEXT). For other types may manually formatting SQL-string.
You can do the same you do now only in your own code. Your code very specific anyway:
- only text and integers are supported,
- why text and bigint and not, varchar and int or even float?
This is unmergable.
float = Number in js
as you wish. I use from my repo
Possible solution is to use sql.Array()
wrapper and specify type there:
sql.update('category', {tags: sql.Array(tags, 'text')}).where(...)