Skip to content

Commit

Permalink
Examples for Query.Data
Browse files Browse the repository at this point in the history
  • Loading branch information
sheharyarn committed Aug 2, 2018
1 parent b4c6253 commit 76766b3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/memento/query/data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ defmodule Memento.Query.Data do
## Usage
Given a Memento Table:
```
# Given a Memento Table
defmodule MyApp.User do
use Memento.Table, attributes: [:id, :name]
end
```
# You can convert its structs to Mnesia format:
You can convert its structs to Mnesia format:
```
Memento.Query.Data.dump(%MyApp.User{id: 1, name: "Sye"})
# => {MyApp.User, 1, "Sye"}
```
Or convert it back to a struct:
# Or convert it back to a struct
```
Memento.Query.Data.load({MyApp.User, 2, "Rick"})
# => %MyApp.User{id: 2, name: "Rick"}
```
Expand Down

0 comments on commit 76766b3

Please sign in to comment.