Skip to content
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

Decide how to handle QueryPointResultType QueryResultRowType subtype #1

Closed
gajus opened this issue Apr 10, 2017 · 1 comment
Closed
Labels

Comments

@gajus
Copy link
Owner

gajus commented Apr 10, 2017

QueryPointResultType is resulting it loads of errors throughout the codebase warning about attempts to cast an object into a string, e.g.

node_modules/mightyql/dist/types.js.flow:21
 21: type QueryPointResultType = {|
                                 ^ object type. This type cannot be added to
 78:     const fuzzyAddressMatch = _.first(fuseUsingAddress.search(venueDetails.street + ', ' + venueDetails.postcode));
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^ string. See: src/bin/commands/update-venue-google-place-id.js:78

node_modules/mightyql/dist/types.js.flow:21
 21: type QueryPointResultType = {|
                                 ^ object type. This type cannot be added to
 78:     const fuzzyAddressMatch = _.first(fuseUsingAddress.search(venueDetails.street + ', ' + venueDetails.postcode));
                                                                                         ^^^^ string. See: src/bin/commands/update-venue-google-place-id.js:78


Found 3 errors

venueDetails is an instance of QueryResultRowType.

This is a valid error... technically venueDetails.street can be an object. Though guarding against every possible case as such is adding way too much boilerplate code.

@gajus gajus added the question label Apr 10, 2017
@gajus
Copy link
Owner Author

gajus commented Apr 10, 2017

Considering how rare QueryPointResultType, I am inclined to remove this annotation at the moment, in favour of explicitly casting QueryResultRowType into QueryPointResultType-capable when required.

@gajus gajus closed this as completed Nov 14, 2018
gajus pushed a commit that referenced this issue Jul 10, 2020
fix: apply type parsers to streamed rows
gajus added a commit that referenced this issue Dec 13, 2021
…ments containing references to positional paraameters

Earier, if you had a query such as sql`SELECT '$1'` Slonik would have thought that $1 is referring to a parameter that is expected to be bound to the query.
Slonik bindings produce custom placeholders (e.g. #$#1) that allow us to distinguish between values bound using Slonik and those added by the user.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant