README.md

# LazyContext

This library enables you to implement default functions in Phoenix contexts

See [Usage](#usage) for example usage.

## Documentation

Documentation is available at [https://hexdocs.pm/lazy_context](https://hexdocs.pm/lazy_context)

## Installation

Add `:lazy_context` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:lazy_context, "~> 0.1.0"}
  ]
end
```

## Configuration

Optionally set the repo for LazyContext config in your `config/config.exs` file:

```elixir
config :lazy_context,
  repo: YourApplication.Repo
```

## Usage

```elixir
defmodule MyApp.Users do
  @moduledoc """
  The Accounts context.
  """

  use LazyContext,
    schema: User,
    suffix: :user,
    # this can be omitted if the repo was set in the context
    repo: MyApp.Repo,
    preloads: [:pets]
end
```

## TODO

- [ ] Tests
- [ ] Improve README
- [ ] Generate documentation
- [ ] Publish on hex.pm
- [ ] Allow custom pluralized function names