README.md
# ActiveSchema
**Rails like auto generated Ecto functions**
## Installation
1. Add `active_schema` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:active_schema, git: "https://gitlab.spice.spiceworks.com/hex_packages/active_schema.git"}
]
end
```
2. Ensure `active_schema` is started before your application:
```elixir
def application do
[
applications: [
:active_schema
]
]
end
```
3. Use `active_schema` in web/web.ex
```elixir
def model do
quote do
use Ecto.ActiveSchema
import Ecto
import Ecto.Changeset
import Ecto.Query, only: [from: 1, from: 2]
end
end
```
## Example
1. Using the default Ecto.Schema
```elixir
iex(1)> Agent.
add_geo_data/1 changeset/1 changeset/2
do_add_geo_data/2
```
2. Using the Ecto.ActiveSchema
```elixir
iex(1)> Agent.
add_geo_data/1 by_command_id/1 by_command_id/2
by_company_id/1 by_company_id/2 by_company_id/3
by_company_key/1 by_company_key/2 by_company_key/3
by_display_name/1 by_display_name/2 by_display_name/3
by_domain/1 by_domain/2 by_domain/3
by_geo_data/1 by_geo_data/2 by_geo_data/3
by_hostname/1 by_hostname/2 by_hostname/3
by_id/1 by_id/2 by_ips/1
by_ips/2 by_ips/3 by_last_contact/1
by_last_contact/2 by_mac/1 by_mac/2
by_mac/3 by_macs/1 by_macs/2
by_macs/3 by_operating_system/1 by_operating_system/2
by_operating_system/3 by_public_ip/1 by_public_ip/2
by_public_ip/3 by_serial/1 by_serial/2
by_serial/3 by_shell_version/1 by_shell_version/2
by_shell_version/3 by_status/1 by_status/2
by_status/3 by_uuid/1 by_uuid/2
by_uuid/3 changeset/1 changeset/2
do_add_geo_data/2 inserted_after/1 inserted_after/2
inserted_before/1 inserted_before/2 last_contact_after/1
last_contact_after/2 last_contact_before/1 last_contact_before/2
updated_after/1 updated_after/2 updated_before/1
updated_before/2 where_disabled/1 where_disabled/2
where_disabled/3 where_is_central/1 where_is_central/2
where_is_central/3 where_uninstall/1 where_uninstall/2
where_uninstall/3 with_commands/0 with_commands/1
with_commands/2
```
## License
```
Copyright © 2017 Spiceworks, Inc.
This work is free. You can redistribute it and/or modify it under the
terms of the MIT License. See the LICENSE file for more details.
```