Current section

Files

Jump to
radish src radish@command@sorted_set.erl
Raw

src/radish@command@sorted_set.erl

-module(radish@command@sorted_set).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([add_new/2, upsert/2, upsert_only_lower_scores/2, upsert_only_higher_scores/2, update/2, update_only_lower_scores/2, update_only_higher_scores/2, incr_by/3, card/1, count/3, score/2, scan/3, scan_pattern/4, 'rem'/2, random_members/2, rank/2, reverse_rank/2, pop_min/2, pop_max/2, range/3, reverse_range/3, range_by_score/3]).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 6).
-spec add_new(binary(), list({binary(), binary()})) -> bitstring().
add_new(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"NX"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 12).
-spec upsert(binary(), list({binary(), binary()})) -> bitstring().
upsert(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 18).
-spec upsert_only_lower_scores(binary(), list({binary(), binary()})) -> bitstring().
upsert_only_lower_scores(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"LT"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 24).
-spec upsert_only_higher_scores(binary(), list({binary(), binary()})) -> bitstring().
upsert_only_higher_scores(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"GT"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 30).
-spec update(binary(), list({binary(), binary()})) -> bitstring().
update(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"XX"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 36).
-spec update_only_lower_scores(binary(), list({binary(), binary()})) -> bitstring().
update_only_lower_scores(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"XX"/utf8>>, <<"LT"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 42).
-spec update_only_higher_scores(binary(), list({binary(), binary()})) -> bitstring().
update_only_higher_scores(Key, Members) ->
_pipe = [<<"ZADD"/utf8>>, Key, <<"XX"/utf8>>, <<"GT"/utf8>>, <<"CH"/utf8>>],
_pipe@1 = lists:append(
_pipe,
gleam@list:map(
Members,
fun(Member) ->
<<(erlang:element(2, Member))/binary,
(erlang:element(1, Member))/binary>>
end
)
),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 48).
-spec incr_by(binary(), binary(), binary()) -> bitstring().
incr_by(Key, Member, Change_in_score) ->
_pipe = [<<"ZINCRBY"/utf8>>, Key, Change_in_score, Member],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 53).
-spec card(binary()) -> bitstring().
card(Key) ->
_pipe = [<<"ZCARD"/utf8>>, Key],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 58).
-spec count(binary(), binary(), binary()) -> bitstring().
count(Key, Min, Max) ->
_pipe = [<<"ZCOUNT"/utf8>>, Key, Min, Max],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 63).
-spec score(binary(), binary()) -> bitstring().
score(Key, Member) ->
_pipe = [<<"ZSCORE"/utf8>>, Key, Member],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 68).
-spec scan(binary(), integer(), integer()) -> bitstring().
scan(Key, Cursor, Count) ->
_pipe = [<<"ZSCAN"/utf8>>,
Key,
erlang:integer_to_binary(Cursor),
<<"COUNT"/utf8>>,
erlang:integer_to_binary(Count)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 73).
-spec scan_pattern(binary(), integer(), binary(), integer()) -> bitstring().
scan_pattern(Key, Cursor, Pattern, Count) ->
_pipe = [<<"ZSCAN"/utf8>>,
Key,
erlang:integer_to_binary(Cursor),
<<"MATCH"/utf8>>,
Pattern,
<<"COUNT"/utf8>>,
erlang:integer_to_binary(Count)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 86).
-spec 'rem'(binary(), list(binary())) -> bitstring().
'rem'(Key, Members) ->
_pipe = [<<"ZREM"/utf8>>, Key],
_pipe@1 = lists:append(_pipe, Members),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 92).
-spec random_members(binary(), integer()) -> bitstring().
random_members(Key, Count) ->
_pipe = [<<"ZRANDMEMBER"/utf8>>,
Key,
erlang:integer_to_binary(Count),
<<"WITHSCORES"/utf8>>],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 97).
-spec rank(binary(), binary()) -> bitstring().
rank(Key, Member) ->
_pipe = [<<"ZRANK"/utf8>>, Key, Member, <<"WITHSCORE"/utf8>>],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 102).
-spec reverse_rank(binary(), binary()) -> bitstring().
reverse_rank(Key, Member) ->
_pipe = [<<"ZREVRANK"/utf8>>, Key, Member, <<"WITHSCORE"/utf8>>],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 107).
-spec pop_min(binary(), integer()) -> bitstring().
pop_min(Key, Count) ->
_pipe = [<<"ZPOPMIN"/utf8>>, Key, erlang:integer_to_binary(Count)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 112).
-spec pop_max(binary(), integer()) -> bitstring().
pop_max(Key, Count) ->
_pipe = [<<"ZPOPMAX"/utf8>>, Key, erlang:integer_to_binary(Count)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 117).
-spec range(binary(), integer(), integer()) -> bitstring().
range(Key, Start, Stop) ->
_pipe = [<<"ZRANGE"/utf8>>,
Key,
erlang:integer_to_binary(Start),
erlang:integer_to_binary(Stop),
<<"WITHSCORES"/utf8>>],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 122).
-spec reverse_range(binary(), integer(), integer()) -> bitstring().
reverse_range(Key, Start, Stop) ->
_pipe = [<<"ZREVRANGE"/utf8>>,
Key,
erlang:integer_to_binary(Start),
erlang:integer_to_binary(Stop),
<<"WITHSCORES"/utf8>>],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/sorted_set.gleam", 127).
-spec range_by_score(binary(), binary(), binary()) -> bitstring().
range_by_score(Key, Min, Max) ->
_pipe = [<<"ZRANGEBYSCORE"/utf8>>, Key, Min, Max, <<"WITHSCORES"/utf8>>],
radish@utils:prepare(_pipe).