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

Support HashMap as implicit type #45

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

jayvdb
Copy link
Collaborator

@jayvdb jayvdb commented Feb 5, 2023

Closes #32

butane_core/src/sqlval.rs Outdated Show resolved Hide resolved
@jayvdb jayvdb force-pushed the hashmap-implicit-type branch from bc3ee10 to 7459128 Compare February 5, 2023 11:54
@jayvdb jayvdb force-pushed the hashmap-implicit-type branch from 7459128 to faeae07 Compare February 7, 2023 01:50
@jayvdb jayvdb marked this pull request as ready for review February 7, 2023 01:56
@jayvdb jayvdb changed the title WIP: Support HashMap as implicit type Support HashMap as implicit type Feb 7, 2023
@@ -113,6 +113,12 @@ impl TypeResolver {
}
}
fn find_type(&self, key: &TypeKey) -> Option<TypeIdentifier> {
#[cfg(feature = "json")]
if let TypeKey::CustomType(ct) = key {
if ct.starts_with("HashMap < String,") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a horrible hack to avoid needing butane_type, which would require a newtype for each type of HashMap.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is another great example of the limitations of trying to create the schema representation at compile time with only the AST and therefore why I'd like to move it to runtime.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I haven't done that yet though, I'm reluctantly OK with the hack for now

@Electron100 Electron100 merged commit b46f714 into Electron100:master Feb 10, 2023
@jayvdb jayvdb deleted the hashmap-implicit-type branch February 10, 2023 03:40
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.

HashMap support
2 participants