Comments (5)
I'm thinking that maybe we need to add a LikeComparison#typecast
that just passes-through the value provided, similar to how RegexpComparison#typecast
does.
from dm-types.
@dkubb Just being a noob here, where does the magic with that comparison happen?
2 cents: Ruby's IPAddr is pretty weak, and doesn't easily allow for important comparisons, like seeing if an IP is in a subnet, getting the subnet mask back from the object after it's set, or other interesting things that ipaddr_extensions and ruby-ip provide. Also, serialization to integer seems to make some more sense than a string.
I would suppose the point of an IP type is getting an IPAddr object back. Is it a bug that you can't compare unlike classes?
from dm-types.
@skord I've written a crude NumericIPAddr Property before. A formal one should probably be added to dm-types, that also packs the netmask as an extra byte. I'm curious if we could mimic the underlying format that MySQL / PostgreSQL uses for native IPs.
from dm-types.
@skord Although switching to a numeric format would make supporting .like
impossible.
from dm-types.
Packing the extra byte? Not thinking about that so much as the efficiency gained from numerical storage and indexing. It's especially apparent when you need to query for all the IP's in a supernet, which may outweigh a text like query when crossing obvious classful subnets. The crux of the issue is deep.
from dm-types.
Related Issues (20)
- DataMapper Incomatibilities with rails 3.1 HOT 1
- bcrypt-ruby update HOT 4
- IPAddress Property does not typecast Resolv::IPv4 / Resolv::IPv6 objects HOT 3
- Please update JSON dependency to 1.6.x HOT 7
- dm-types redefines the global CSV constant on Ruby 1.8 HOT 3
- ParanoidBoolean causes issues with belongs_to Relationships HOT 1
- UUID: got error on jruby HOT 2
- uninitialized constant ClassName::Enum HOT 3
- Enums are nil when an already created object is fetched HOT 6
- multi-json dependency HOT 1
- Bump stringex dependency to ~>2.0.2 HOT 5
- [release 1.2] rspec failing HOT 1
- Upgrade to safe_yaml
- Exception when assigning an arbitrary string to a Json field
- brcypt-ruby name change HOT 6
- can't modify frozen NilClass HOT 12
- Missing code in release v1.2.2 HOT 3
- UUID missing from migration type map HOT 1
- Update json dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dm-types.