Skip to content

Adds support for SqlSqlToken as a memberType in sql.unnest (fixes #326) #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 1, 2022

Conversation

gajus
Copy link
Owner

@gajus gajus commented Mar 26, 2022

  • corrects invalid references to SqlToken when intention is SqlSqlToken
  • adds support for SqlSqlToken as a memberType in sql.unnest

After these changes are released, if sql.unnest columnType array member type is SqlToken, it will inline type name without quotes, e.g.

await connection.query(sql`
  SELECT bar, baz
  FROM ${sql.unnest(
    [
      [1, 'foo'],
      [2, 'bar']
    ],
    [
      sql`integer`,
      sql`text`
    ]
  )} AS foo(bar, baz)
`);

Produces:

{
  sql: 'SELECT bar, baz FROM unnest($1::integer[], $2::text[]) AS foo(bar, baz)',
  values: [
    [
      1,
      2
    ],
    [
      'foo',
      'bar'
    ]
  ]
}

@coveralls
Copy link

coveralls commented Mar 26, 2022

Coverage Status

Coverage increased (+0.04%) to 88.873% when pulling ffa7f6c on gajus/add-generate-type-name into 476a856 on master.

@gajus gajus changed the title Provide enum for all built-in types (fixes #326) Adds support for SqlSqlToken as a memberType in sql.unnest (fixes #326) Apr 1, 2022
@gajus gajus merged commit ec950da into master Apr 1, 2022
@gajus
Copy link
Owner Author

gajus commented Apr 1, 2022

🎉 This PR is included in version 28.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Apr 1, 2022
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.

None yet

2 participants