fix(better-sqlite3): Emit correct types instead of any #65
+16
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sqlite's driver was not generating types properly, it was returning all columns as
any
attributes instead of inferring the type from the schema.Here's an example:
Source file:
Generated code:
When debugging the driver I noticed the received
Column
in thecolumnType
method where:I decided to convert the
column.type.name
to lowercase and addTEXT
andVARCHAR
types to the switch case. After building the wasm module, I run it withexamples/sqlc.dev.yaml
config file and the example file got updated.