ydb-nodejs-sdk icon indicating copy to clipboard operation
ydb-nodejs-sdk copied to clipboard

feat: Automatically declare named expressions for query parameters

Open Gaspero opened this issue 2 years ago • 0 comments

Feature Request

Describe the Feature Request

Automatically declare named expressions for query parameters so that developer could avoid writing "DECLARE $ ... AS Type;" manually for each parameter.

Describe Preferred Solution

Pass WithAutoDeclare as an option when initializing DB driver.

Describe Alternatives

Provide a helper that could be used to wrap individual queries.

Related Code

Go SDK reference implementation. https://github.com/ydb-platform/ydb-go-sdk/blob/17e76a4a2c01f5a7a0e10f5a60b31602d4575ef9/internal/bind/auto_declare.go

Additional Context

This feature would play nicely with Kysely Adapter and is partially implemented in it. I think that this functionality should belong to SDK. https://github.com/ydb-platform/ydb-nodejs-sdk/issues/332

If the feature request is approved, would you be willing to submit a PR?

Yes

Gaspero avatar Nov 15 '23 16:11 Gaspero