EctoNetwork
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
Add
:ecto_networkto your list of dependencies inmix.exs:def deps do[{:ecto_network, "~> 1.6.1"}]endCreate your migrations using the Postgres types as atoms.
def change docreate table(:your_table) doadd :ip_address, :inetadd :mac_address, :macaddradd :network, :cidrendendUse the new types in your Ecto schemas.
schema "your_table" dofield :ip_address, EctoNetwork.INETfield :mac_address, EctoNetwork.MACADDRfield :network, EctoNetwork.CIDRend
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.