stephenafamo / bob

SQL query builder and ORM/Factory generator for Go with support for PostgreSQL, MySQL and SQLite
https://bob.stephenafamo.com
MIT License
701 stars 37 forks source link

fix psql inet type without subnet #234

Closed gstarikov closed 3 weeks ago

gstarikov commented 3 weeks ago

Hi. Postgres inet type may contain /32 or /128 subnet and in that cases postgress will return string without '/' and netip.ParsePrefix will fail with error.

stephenafamo commented 3 weeks ago

However, I'm currently working on this, alongside other changes to types as a whole, so this is badly timed 😬

I'll close this PR now, but please send in other PRs if you have the time. I really appreciate the help 🙏🏾

stephenafamo commented 3 weeks ago

Actually, this has already been released in v0.27.0

https://github.com/stephenafamo/bob/releases/tag/v0.27.0#:~:text=Use%20netip.Addr%20instead%20of%20netip.Prefix%20for%20Postgres%20cidr%20type

gstarikov commented 3 weeks ago

there is support for cidr postgres type in 0.27.0 , but i need to fix inet support. in case of inet type and single ip subnet (/32 or /128) postgres will return only ip addres, without '/' suffix and netip.ParsePrefix will fail with error.

stephenafamo commented 3 weeks ago

I understand now. This is very helpful.