Skip to content

Empty value fails to parse as bool #128

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

Closed
fspinolo opened this issue Jan 19, 2024 · 2 comments
Closed

Empty value fails to parse as bool #128

fspinolo opened this issue Jan 19, 2024 · 2 comments

Comments

@fspinolo
Copy link

I am using this library to read a sample mmdb provided by IPInfo at https://github.com/ipinfo/sample-database/blob/main/Privacy%20Detection/privacy_detection_sample.mmdb.

The records contain several boolean fields, and use an empty value to signify "false". This fails with maxminddb: cannot unmarshal into type bool. I would expect it to treat it as a false value (the zero value for a bool in Go).

Can decoding be updated to support this case?

@oschwald
Copy link
Owner

Unfortunately, I don't see any boolean values in the provided database. I do see strings with values like "true" and "". Similar to encoding/json and other libraries, this library does not support decoding a string to a boolean. Although it is probably too late for them to change it, it would be nice if the database used the correct types when encoding the data.

@fspinolo
Copy link
Author

Thanks for confirming the issue! I will take it up with IPInfo.

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

No branches or pull requests

2 participants