Giter Site home page Giter Site logo

Comments (5)

dkubb avatar dkubb commented on July 23, 2024

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.

skord avatar skord commented on July 23, 2024

@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.

postmodern avatar postmodern commented on July 23, 2024

@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.

postmodern avatar postmodern commented on July 23, 2024

@skord Although switching to a numeric format would make supporting .like impossible.

from dm-types.

skord avatar skord commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.