-module(radish@list). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]). -export([lpush/4, rpush/4, lpushx/4, rpushx/4, llen/3, lrange/5, lpop/3, rpop/3, lpop_multiple/4, rpop_multiple/4]). -spec lpush( gleam@erlang@process:subject(radish@client:message()), binary(), list(binary()), integer() ) -> {ok, integer()} | {error, radish@error:error()}. lpush(Client, Key, Values, Timeout) -> _pipe = radish@command@list:lpush(Key, Values), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {integer, N} -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec rpush( gleam@erlang@process:subject(radish@client:message()), binary(), list(binary()), integer() ) -> {ok, integer()} | {error, radish@error:error()}. rpush(Client, Key, Values, Timeout) -> _pipe = radish@command@list:rpush(Key, Values), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {integer, N} -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec lpushx( gleam@erlang@process:subject(radish@client:message()), binary(), list(binary()), integer() ) -> {ok, integer()} | {error, radish@error:error()}. lpushx(Client, Key, Values, Timeout) -> _pipe = radish@command@list:lpushx(Key, Values), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {integer, N} -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec rpushx( gleam@erlang@process:subject(radish@client:message()), binary(), list(binary()), integer() ) -> {ok, integer()} | {error, radish@error:error()}. rpushx(Client, Key, Values, Timeout) -> _pipe = radish@command@list:rpushx(Key, Values), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {integer, N} -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec llen( gleam@erlang@process:subject(radish@client:message()), binary(), integer() ) -> {ok, integer()} | {error, radish@error:error()}. llen(Client, Key, Timeout) -> _pipe = radish@command@list:llen(Key), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {integer, N} -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec lrange( gleam@erlang@process:subject(radish@client:message()), binary(), integer(), integer(), integer() ) -> {ok, list(binary())} | {error, radish@error:error()}. lrange(Client, Key, Start, End, Timeout) -> _pipe = radish@command@list:lrange(Key, Start, End), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {array, Array} -> gleam@list:try_map(Array, fun(Item) -> case Item of {bulk_string, Str} -> {ok, Str}; _ -> {error, resp_error} end end); _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec lpop( gleam@erlang@process:subject(radish@client:message()), binary(), integer() ) -> {ok, binary()} | {error, radish@error:error()}. lpop(Client, Key, Timeout) -> _pipe = radish@command@list:lpop(Key, none), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {bulk_string, Str} -> {ok, Str}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec rpop( gleam@erlang@process:subject(radish@client:message()), binary(), integer() ) -> {ok, binary()} | {error, radish@error:error()}. rpop(Client, Key, Timeout) -> _pipe = radish@command@list:rpop(Key, none), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {bulk_string, Str} -> {ok, Str}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec lpop_multiple( gleam@erlang@process:subject(radish@client:message()), binary(), integer(), integer() ) -> {ok, list(binary())} | {error, radish@error:error()}. lpop_multiple(Client, Key, Count, Timeout) -> _pipe = radish@command@list:lpop(Key, {some, Count}), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {array, Array} -> gleam@list:try_map(Array, fun(Item) -> case Item of {bulk_string, Str} -> {ok, Str}; _ -> {error, resp_error} end end); _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -spec rpop_multiple( gleam@erlang@process:subject(radish@client:message()), binary(), integer(), integer() ) -> {ok, list(binary())} | {error, radish@error:error()}. rpop_multiple(Client, Key, Count, Timeout) -> _pipe = radish@command@list:rpop(Key, {some, Count}), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value) -> case Value of {array, Array} -> gleam@list:try_map(Array, fun(Item) -> case Item of {bulk_string, Str} -> {ok, Str}; _ -> {error, resp_error} end end); _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2).