-module(radish@list). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([lpush/4, rpush/4, lpushx/4, rpushx/4, len/3, range/5, lpop/3, blpop/3, rpop/3, brpop/3, lpop_multiple/4, rpop_multiple/4, index/4, 'rem'/5, set/5, insert_after/5, insert_before/5]). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 13). -spec lpush( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 26). -spec rpush( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 39). -spec lpushx( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 52). -spec rpushx( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 65). -spec len(lifeguard:pool(radish@client:message()), binary(), integer()) -> {ok, integer()} | {error, radish@error:error()}. len(Client, Key, Timeout) -> _pipe = radish@command@list:len(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 78). -spec range( lifeguard:pool(radish@client:message()), binary(), integer(), integer(), integer() ) -> {ok, list(binary())} | {error, radish@error:error()}. range(Client, Key, Start, End, Timeout) -> _pipe = radish@command@list:range(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 97). -spec lpop(lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 110). -spec blpop(lifeguard:pool(radish@client:message()), list(binary()), integer()) -> {ok, list({binary(), binary()})} | {error, radish@error:error()}. blpop(Client, Keys, Timeout) -> _pipe = radish@command@list:blpop(Keys, Timeout), _pipe@1 = radish@utils:execute_blocking(Client, _pipe, Timeout), _pipe@3 = gleam@result:map(_pipe@1, fun(Value) -> case Value of [{array, Array}] -> _pipe@2 = gleam@list:sized_chunk(Array, 2), gleam@list:try_map(_pipe@2, fun(Kv) -> case Kv of [{bulk_string, Key}, {bulk_string, Value@1}] -> {ok, {Key, Value@1}}; _ -> {error, resp_error} end end); [null] -> {error, not_found}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@3). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 131). -spec rpop(lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 144). -spec brpop(lifeguard:pool(radish@client:message()), list(binary()), integer()) -> {ok, list({binary(), binary()})} | {error, radish@error:error()}. brpop(Client, Keys, Timeout) -> _pipe = radish@command@list:brpop(Keys, Timeout), _pipe@1 = radish@utils:execute_blocking(Client, _pipe, Timeout), _pipe@3 = gleam@result:map(_pipe@1, fun(Value) -> case Value of [{array, Array}] -> _pipe@2 = gleam@list:sized_chunk(Array, 2), gleam@list:try_map(_pipe@2, fun(Kv) -> case Kv of [{bulk_string, Key}, {bulk_string, Value@1}] -> {ok, {Key, Value@1}}; _ -> {error, resp_error} end end); [null] -> {error, not_found}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@3). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 165). -spec lpop_multiple( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 184). -spec rpop_multiple( lifeguard:pool(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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 203). -spec index( lifeguard:pool(radish@client:message()), binary(), integer(), integer() ) -> {ok, integer()} | {error, radish@error:error()}. index(Client, Key, Index, Timeout) -> _pipe = radish@command@list:index(Key, Index), _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). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 216). -spec 'rem'( lifeguard:pool(radish@client:message()), binary(), integer(), binary(), integer() ) -> {ok, integer()} | {error, radish@error:error()}. 'rem'(Client, Key, Count, Value, Timeout) -> _pipe = radish@command@list:'rem'(Key, Count, Value), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value@1) -> case Value@1 of [{integer, N}] -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 229). -spec set( lifeguard:pool(radish@client:message()), binary(), integer(), binary(), integer() ) -> {ok, binary()} | {error, radish@error:error()}. set(Client, Key, Index, Value, Timeout) -> _pipe = radish@command@list:set(Key, Index, Value), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value@1) -> case Value@1 of [{simple_string, Str}] -> {ok, Str}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 242). -spec insert_after( lifeguard:pool(radish@client:message()), binary(), binary(), binary(), integer() ) -> {ok, integer()} | {error, radish@error:error()}. insert_after(Client, Key, Pivot, Value, Timeout) -> _pipe = radish@command@list:insert_after(Key, Pivot, Value), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value@1) -> case Value@1 of [{integer, N}] -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2). -file("/home/massivefermion/Desktop/radish/src/radish/list.gleam", 261). -spec insert_before( lifeguard:pool(radish@client:message()), binary(), binary(), binary(), integer() ) -> {ok, integer()} | {error, radish@error:error()}. insert_before(Client, Key, Pivot, Value, Timeout) -> _pipe = radish@command@list:insert_before(Key, Pivot, Value), _pipe@1 = radish@utils:execute(Client, _pipe, Timeout), _pipe@2 = gleam@result:map(_pipe@1, fun(Value@1) -> case Value@1 of [{integer, N}] -> {ok, N}; _ -> {error, resp_error} end end), gleam@result:flatten(_pipe@2).