Current section
Files
Jump to
Current section
Files
src/radish@command@list.erl
-module(radish@command@list).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([lpush/2, rpush/2, lpushx/2, rpushx/2, len/1, range/3, lpop/2, blpop/2, rpop/2, brpop/2, index/2, 'rem'/3, set/3, insert_after/3, insert_before/3]).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 8).
-spec lpush(binary(), list(binary())) -> bitstring().
lpush(Key, Values) ->
_pipe = [<<"LPUSH"/utf8>>, Key],
_pipe@1 = lists:append(_pipe, Values),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 14).
-spec rpush(binary(), list(binary())) -> bitstring().
rpush(Key, Values) ->
_pipe = [<<"RPUSH"/utf8>>, Key],
_pipe@1 = lists:append(_pipe, Values),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 20).
-spec lpushx(binary(), list(binary())) -> bitstring().
lpushx(Key, Values) ->
_pipe = [<<"LPUSHX"/utf8>>, Key],
_pipe@1 = lists:append(_pipe, Values),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 26).
-spec rpushx(binary(), list(binary())) -> bitstring().
rpushx(Key, Values) ->
_pipe = [<<"RPUSHX"/utf8>>, Key],
_pipe@1 = lists:append(_pipe, Values),
radish@utils:prepare(_pipe@1).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 32).
-spec len(binary()) -> bitstring().
len(Key) ->
_pipe = [<<"LLEN"/utf8>>, Key],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 37).
-spec range(binary(), integer(), integer()) -> bitstring().
range(Key, Start, End) ->
_pipe = [<<"LRANGE"/utf8>>,
Key,
erlang:integer_to_binary(Start),
erlang:integer_to_binary(End)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 42).
-spec lpop(binary(), gleam@option:option(integer())) -> bitstring().
lpop(Key, Count) ->
_pipe = case Count of
none ->
[<<"LPOP"/utf8>>, Key];
{some, Count@1} ->
[<<"LPOP"/utf8>>, Key, erlang:integer_to_binary(Count@1)]
end,
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 50).
-spec blpop(list(binary()), integer()) -> bitstring().
blpop(Keys, Timeout) ->
_assert_subject = begin
_pipe = Timeout,
_pipe@1 = erlang:float(_pipe),
gleam@float:divide(_pipe@1, 1000.0)
end,
{ok, Timeout@1} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"radish/command/list"/utf8>>,
function => <<"blpop"/utf8>>,
line => 51})
end,
_pipe@2 = [<<"BLPOP"/utf8>>],
_pipe@3 = lists:append(_pipe@2, Keys),
_pipe@6 = lists:append(
_pipe@3,
[begin
_pipe@4 = Timeout@1,
_pipe@5 = erlang:round(_pipe@4),
erlang:integer_to_binary(_pipe@5)
end]
),
radish@utils:prepare(_pipe@6).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 66).
-spec rpop(binary(), gleam@option:option(integer())) -> bitstring().
rpop(Key, Count) ->
_pipe = case Count of
none ->
[<<"RPOP"/utf8>>, Key];
{some, Count@1} ->
[<<"RPOP"/utf8>>, Key, erlang:integer_to_binary(Count@1)]
end,
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 74).
-spec brpop(list(binary()), integer()) -> bitstring().
brpop(Keys, Timeout) ->
_assert_subject = begin
_pipe = Timeout,
_pipe@1 = erlang:float(_pipe),
gleam@float:divide(_pipe@1, 1000.0)
end,
{ok, Timeout@1} = case _assert_subject of
{ok, _} -> _assert_subject;
_assert_fail ->
erlang:error(#{gleam_error => let_assert,
message => <<"Pattern match failed, no pattern matched the value."/utf8>>,
value => _assert_fail,
module => <<"radish/command/list"/utf8>>,
function => <<"brpop"/utf8>>,
line => 75})
end,
_pipe@2 = [<<"BRPOP"/utf8>>],
_pipe@3 = lists:append(_pipe@2, Keys),
_pipe@6 = lists:append(
_pipe@3,
[begin
_pipe@4 = Timeout@1,
_pipe@5 = erlang:round(_pipe@4),
erlang:integer_to_binary(_pipe@5)
end]
),
radish@utils:prepare(_pipe@6).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 90).
-spec index(binary(), integer()) -> bitstring().
index(Key, Index) ->
_pipe = [<<"LINDEX"/utf8>>, Key, erlang:integer_to_binary(Index)],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 95).
-spec 'rem'(binary(), integer(), binary()) -> bitstring().
'rem'(Key, Count, Value) ->
_pipe = [<<"LREM"/utf8>>, Key, erlang:integer_to_binary(Count), Value],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 100).
-spec set(binary(), integer(), binary()) -> bitstring().
set(Key, Index, Value) ->
_pipe = [<<"LSET"/utf8>>, Key, erlang:integer_to_binary(Index), Value],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 105).
-spec insert_after(binary(), binary(), binary()) -> bitstring().
insert_after(Key, Pivot, Value) ->
_pipe = [<<"LINSERT"/utf8>>, Key, <<"AFTER"/utf8>>, Pivot, Value],
radish@utils:prepare(_pipe).
-file("/home/massivefermion/Desktop/radish/src/radish/command/list.gleam", 110).
-spec insert_before(binary(), binary(), binary()) -> bitstring().
insert_before(Key, Pivot, Value) ->
_pipe = [<<"LINSERT"/utf8>>, Key, <<"BEFORE"/utf8>>, Pivot, Value],
radish@utils:prepare(_pipe).