• This repository has been archived on 27/Jan/2019
  • Stars
    star
    15
  • Rank 1,371,379 (Top 28 %)
  • Language
    Elixir
  • Created over 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Red

Hex version Build status Deps Status Inline docs Hex downloads

Store relations between entities using redis.

Example: A follow system

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
> []