Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rodrigues/red
https://github.com/rodrigues/red
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rodrigues/red
- Owner: rodrigues
- Archived: true
- Created: 2015-05-12T21:11:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-07T19:03:45.000Z (about 7 years ago)
- Last Synced: 2024-08-09T10:03:13.759Z (3 months ago)
- Language: Elixir
- Homepage: https://hexdocs.pm/red
- Size: 43 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - Persist relationships between objects in Redis, in a graph-like way. (ORM and Datamapping)
- fucking-awesome-elixir - red - Persist relationships between objects in Redis, in a graph-like way. (ORM and Datamapping)
- awesome-elixir - red - Persist relationships between objects in Redis, in a graph-like way. (ORM and Datamapping)
README
Red
===[![Hex version](https://img.shields.io/hexpm/v/red.svg "Hex version")](https://hex.pm/packages/red)
[![Build status](https://img.shields.io/travis/rodrigues/red.svg "Build status")](https://travis-ci.org/rodrigues/red)
[![Deps Status](https://beta.hexfaktor.org/badge/all/github/rodrigues/red.svg)](https://beta.hexfaktor.org/github/rodrigues/red)
[![Inline docs](http://inch-ci.org/github/rodrigues/red.svg?branch=master&style=flat)](http://hexdocs.pm/red)
![Hex downloads](https://img.shields.io/hexpm/dt/red.svg "Hex downloads")Store relations between entities using [redis](http://redis.io).
## Example: A `follow` system
```elixir
import Red# @vcr2 -{follow}-> @hex_pm
{:ok, _} =
"@vcr2"
|> relation(:follow)
|> add!("@hex_pm")"@vcr2" |> relation(:follow) |> Enum.at(0)
> "@hex_pm"# @vcr2 ===follow===> *
count_following = "@vcr2" |> relation(:follow) |> Enum.count
> 100# @vcr2 <===follow=== *
count_followers = "@vcr2" |> relation(:follow, :in) |> Enum.count
> 43# jump 10, next 5
"@vcr2" |> relation(:follow) |> offset(10) |> limit(5) |> Enum.to_list
> []
```