Skip to content

Commit

Permalink
Add more docs:
Browse files Browse the repository at this point in the history
- The process of improving docs keeps going on
  • Loading branch information
thebugcatcher committed Mar 5, 2017
1 parent 94bd766 commit 5a6ed87
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
24 changes: 19 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Rummage.Ecto Versions CHANGELOG
# Versions CHANGELOG

## Version: 1.0.0

Expand All @@ -17,12 +17,26 @@

### Change in `rummage` struct syntaxes:
- `search` key:
- Earlier: rummage = %{"search" => %{"field_1" => "field_!"}}
- Now: rummage = %{"search" => %{"field_1" => {["association_name"], "like", "field_!"}}}
- Earlier:
```elixir
rummage = %{"search" => %{"field_1" => "field_!"}}
```

- Now:
```elixir
rummage = %{"search" => %{"field_1" => %{"assoc" => ["assoc_1", "assoc_2"], "search_type" => "like", "search_term" => "field_!"}}
```

- `sort` key:
- Earlier: %{"sort" => "field_1.asc"}
- Now: %{"sort" => {["association_name", "association_name"], "field_1.asc.ci"}}
- Earlier:
```elixir
rummage = %{"sort" => "field_1.asc"}
```

- Now:
```elixir
rummage = %{"sort" => %{"assoc" => ["assoc_1", "assoc_2"], "field" => "field_1.asc"}}
```

- `paginate` key: NO CHANGES

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ to it. You can check `Rummage.Phoenix` out by clicking [here](https://github.com

**Please refer for [CHANGELOG](CHANGELOG.md) for version specific changes**

`Rummage.Ecto` is a framework that can be used to alter `Ecto` queries with Search, Sort and Paginate operations.
`Rummage.Ecto` is a light weight, but powerful framework that can be used to alter `Ecto` queries with Search, Sort and Paginate operations.

It accomplishes the above operations by using `Hooks`, which are modules that implement `Rumamge.Ecto.Hook` behavior.
Each operation: `Search`, `Sort` and `Paginate` have their hooks defined in `Rummage`. By doing this, `Rummage` is completely
Expand Down
2 changes: 1 addition & 1 deletion doc_readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ to it. You can check `Rummage.Phoenix` out by clicking [here](https://github.com

**Please refer for `CHANGELOG` for version specific changes**

`Rummage.Ecto` is a framework that can be used to alter `Ecto` queries with Search, Sort and Paginate operations.
`Rummage.Ecto` is a light weight, but powerful framework that can be used to alter `Ecto` queries with Search, Sort and Paginate operations.

It accomplishes the above operations by using `Hooks`, which are modules that implement `Rumamge.Ecto.Hook` behavior.
Each operation: `Search`, `Sort` and `Paginate` have their hooks defined in `Rummage`. By doing this, `Rummage` is completely
Expand Down
4 changes: 2 additions & 2 deletions lib/rummage_ecto.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Rummage.Ecto do
@moduledoc ~S"""
Rummage.Ecto is a simple framework that can be used to alter Ecto queries with
Search, Sort and Paginate operations.
Rummage.Ecto is a light weight, but powerful framework that can be used to alter Ecto
queries with Search, Sort and Paginate operations.
It accomplishes the above operations by using `Hooks`, which are modules that
implement `Rumamge.Ecto.Hook` behavior. Each operation: Search, Sort and Paginate
Expand Down
7 changes: 2 additions & 5 deletions lib/rummage_ecto/hooks/paginate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ defmodule Rummage.Ecto.Hooks.Paginate do
default_paginate: CustomHook
```
The `CustomHook` must implement `@behaviour Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir:
* `Rummage.Ecto.CustomHooks.SimpleSearch`
* `Rummage.Ecto.CustomHooks.SimpleSort`
The `CustomHook` must implement behaviour `Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir: `Rummage.Ecto.CustomHooks.SimpleSearch`, `Rummage.Ecto.CustomHooks.SimpleSort`
"""

import Ecto.Query
Expand Down
9 changes: 4 additions & 5 deletions lib/rummage_ecto/hooks/search.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Rummage.Ecto.Hooks.Search do
alias Rummage.Ecto.Hooks.Search
searched_queryable = Search.run(Parent, %{"search" => %{"field_1" => %{"assoc" => [], "search_type" => "like", "search_term" => "field_!"}}}
```
For a case-insensitive search:
Expand All @@ -29,6 +30,7 @@ defmodule Rummage.Ecto.Hooks.Search do
alias Rummage.Ecto.Hooks.Search
searched_queryable = Search.run(Parent, %{"search" => %{"field_1" => %{"assoc" => [], "search_type" => "ilike", "search_term" => "field_!"}}}
```
There are many other `search_types`. Check out `Rummage.Ecto.Services.BuildSearchQuery`'s docs
Expand All @@ -54,11 +56,8 @@ defmodule Rummage.Ecto.Hooks.Search do
default_search: CustomHook
```
The `CustomHook` must implement `@behaviour Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir:
* `Rummage.Ecto.CustomHooks.SimpleSearch`
* `Rummage.Ecto.CustomHooks.SimpleSort`
The `CustomHook` must implement `behaviour `Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir: `Rummage.Ecto.CustomHooks.SimpleSearch`, `Rummage.Ecto.CustomHooks.SimpleSort`
"""

import Ecto.Query
Expand Down
11 changes: 4 additions & 7 deletions lib/rummage_ecto/hooks/sort.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule Rummage.Ecto.Hooks.Sort do
```elixir
alias Rummage.Ecto.Hooks.Sort
sorted_queryable = Sort.run(Parent, %{"sort" => %{"assoc" => [], "field" => "field_1.asc"}])
sorted_queryable = Sort.run(Parent, %{"sort" => %{"assoc" => [], "field" => "field_1.asc"}})
```
For a case-insensitive sort:
Expand All @@ -25,7 +25,7 @@ defmodule Rummage.Ecto.Hooks.Sort do
```elixir
alias Rummage.Ecto.Hooks.Sort
sorted_queryable = Sort.run(Parent, %{"sort" => %{"assoc" => [], "field" => "field_1.asc.ci"}])
sorted_queryable = Sort.run(Parent, %{"sort" => %{"assoc" => [], "field" => "field_1.asc.ci"}})
```
Expand All @@ -49,11 +49,8 @@ defmodule Rummage.Ecto.Hooks.Sort do
default_sort: CustomHook
```
The `CustomHook` must implement `@behaviour Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir:
* `Rummage.Ecto.CustomHooks.SimpleSearch`
* `Rummage.Ecto.CustomHooks.SimpleSort`
The `CustomHook` must implement behaviour `Rummage.Ecto.Hook`. For examples of `CustomHook`, check out some
`custom_hooks` that are shipped with elixir: `Rummage.Ecto.CustomHooks.SimpleSearch`, `Rummage.Ecto.CustomHooks.SimpleSort`
"""

import Ecto.Query
Expand Down

0 comments on commit 5a6ed87

Please sign in to comment.