All Projects → adam12 → ecto_network

adam12 / ecto_network

Licence: MIT License
Ecto types to support MACADDR and Network extensions provided by Postgrex.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to ecto network

ecto autoslug field
Automatically create slugs for Ecto schemas.
Stars: ✭ 138 (+228.57%)
Mutual labels:  ecto-types

EctoNetwork

Build Status Module Version Hex Docs Total Download License Last Updated

Ecto types to support MACADDR and Network extensions provided by Postgrex.

Although this is primarily an Ecto library, it has a hard dependency on Postgrex due to the types it is providing.

Installation

  1. Add :ecto_network to your list of dependencies in mix.exs:

    def deps do
      [
        # or 0.7.0 if you're stuck on Ecto < 3
        {:ecto_network, "~> 1.3.0"}
      ]
    end
  2. Create your migrations using the Postgres types as atoms.

    def change do
      create table(:your_table) do
        add :ip_address, :inet
        add :mac_address, :macaddr
        add :network, :cidr
      end
    end
  3. Use the new types in your Ecto schemas.

    schema "your_table" do
      field :ip_address, EctoNetwork.INET
      field :mac_address, EctoNetwork.MACADDR
      field :network, EctoNetwork.CIDR
    end

Contributing

I love pull requests! If you fork this project and modify it, please ping me to see if your changes can be incorporated back into this project.

That said, if your feature idea is nontrivial, you should probably open an issue to discuss it before attempting a pull request.

Copyright and License

Copyright (c) 2016 Adam Daniels and contributors

EctoNetwork is released under the MIT License. See LICENSE.md for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].