-module(radish@command@list). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]). -export([lpush/2, rpush/2, lpushx/2, rpushx/2, llen/1, lrange/3, lpop/2, rpop/2, lindex/2, lrem/3, lset/3, linsert_after/3, linsert_before/3]). -spec lpush(binary(), list(binary())) -> bitstring(). lpush(Key, Values) -> _pipe = [<<"LPUSH"/utf8>>, Key], _pipe@1 = gleam@list:append( _pipe, gleam@list:map(Values, fun(Value) -> Value end) ), radish@utils:prepare(_pipe@1). -spec rpush(binary(), list(binary())) -> bitstring(). rpush(Key, Values) -> _pipe = [<<"RPUSH"/utf8>>, Key], _pipe@1 = gleam@list:append( _pipe, gleam@list:map(Values, fun(Value) -> Value end) ), radish@utils:prepare(_pipe@1). -spec lpushx(binary(), list(binary())) -> bitstring(). lpushx(Key, Values) -> _pipe = [<<"LPUSHX"/utf8>>, Key], _pipe@1 = gleam@list:append( _pipe, gleam@list:map(Values, fun(Value) -> Value end) ), radish@utils:prepare(_pipe@1). -spec rpushx(binary(), list(binary())) -> bitstring(). rpushx(Key, Values) -> _pipe = [<<"RPUSHX"/utf8>>, Key], _pipe@1 = gleam@list:append( _pipe, gleam@list:map(Values, fun(Value) -> Value end) ), radish@utils:prepare(_pipe@1). -spec llen(binary()) -> bitstring(). llen(Key) -> _pipe = [<<"LLEN"/utf8>>, Key], radish@utils:prepare(_pipe). -spec lrange(binary(), integer(), integer()) -> bitstring(). lrange(Key, Start, End) -> _pipe = [<<"LRANGE"/utf8>>, Key, gleam@int:to_string(Start), gleam@int:to_string(End)], radish@utils:prepare(_pipe). -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, gleam@int:to_string(Count@1)] end, radish@utils:prepare(_pipe). -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, gleam@int:to_string(Count@1)] end, radish@utils:prepare(_pipe). -spec lindex(binary(), integer()) -> bitstring(). lindex(Key, Index) -> _pipe = [<<"LINDEX"/utf8>>, Key, gleam@int:to_string(Index)], radish@utils:prepare(_pipe). -spec lrem(binary(), integer(), binary()) -> bitstring(). lrem(Key, Count, Value) -> _pipe = [<<"LREM"/utf8>>, Key, gleam@int:to_string(Count), Value], radish@utils:prepare(_pipe). -spec lset(binary(), integer(), binary()) -> bitstring(). lset(Key, Index, Value) -> _pipe = [<<"LSET"/utf8>>, Key, gleam@int:to_string(Index), Value], radish@utils:prepare(_pipe). -spec linsert_after(binary(), binary(), binary()) -> bitstring(). linsert_after(Key, Pivot, Value) -> _pipe = [<<"LINSERT"/utf8>>, Key, <<"AFTER"/utf8>>, Pivot, Value], radish@utils:prepare(_pipe). -spec linsert_before(binary(), binary(), binary()) -> bitstring(). linsert_before(Key, Pivot, Value) -> _pipe = [<<"LINSERT"/utf8>>, Key, <<"BEFORE"/utf8>>, Pivot, Value], radish@utils:prepare(_pipe).