Open travisfw opened 10 years ago
Hi Travis,
I've been reading the documentation of inet a cidr types but I'm not really sure what is the usage you are expecting. Could you please provide an example of what do you want to achieve or what is the usage you like?
For example, in a domain class, what is the native type of the inet a cidr postgres types, a java.lang.String?
String inetField
String cidrField
Once that this is done. What are the queries would you like to execute?
Regards, Iván.
So I'm learning Grails presently, so if there's another canonical way to do things, let me know.
I want to use inet for access logging like "last time you logged in was on $date from ip $inet". On the Java side it might be a java.net.InterfaceAddress. The server may use the data to differentiate between LAN access and WAN, for instance, but other indexing and sorting become possible vs parsing a string. It's also a more efficient data type in terms of both storage and processing, not that that matters a lot.
I've been busy with a new contract but when I come back to this project I would have a more fleshed out example. I appreciate your consideration of this ticket @lmivan.
Hello again @travisfw,
I've doing some tests using the cidr
and inet
postgres types and the operators: http://www.postgresql.org/docs/current/interactive/functions-net.html. I think it shouldn't be too dificult to implement the hibernate criterias for these types.
In the Java side, I haven't worked with java.net.InterfaceAddress
. I've googled it and I think I can use InetAddress.
What do you think?
Regards, Iván.
InetAddress was my initial thought too, but it doesn't support a mask, which cidr and inet do. Looking again at InterfaceAddress I guess you can't just instantiate one so it's not so useful. Seems like you're right.
Hi, Is it possible that you will add support for inet type in the near future?
Hi @odubinkin, I don't plan to work on this in the near future but if you submit a PR with the changes I will review, merge it and release a new version with that feature.
Add support for inet and cidr: http://www.postgresql.org/docs/current/interactive/datatype-net-types.html