Skip to content

Conversation

@cybermerlin
Copy link

@cybermerlin cybermerlin commented Nov 18, 2017

@Suor
Copy link
Owner

Suor commented Nov 23, 2017

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?

@cybermerlin
Copy link
Author

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.

@Suor
Copy link
Owner

Suor commented Nov 28, 2017

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.

@cybermerlin
Copy link
Author

float = Number in js

@cybermerlin
Copy link
Author

as you wish. I use from my repo

@Suor Suor closed this Dec 4, 2017
@Suor
Copy link
Owner

Suor commented Feb 23, 2018

Possible solution is to use sql.Array() wrapper and specify type there:

sql.update('category', {tags: sql.Array(tags, 'text')}).where(...)

@Suor Suor reopened this Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants