Current section

Files

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

src/radish@command@set.erl

-module(radish@command@set).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([add/2, card/1, is_member/2, members/1, scan/3, scan_pattern/4]).
-spec add(binary(), list(binary())) -> bitstring().
add(Key, Values) ->
_pipe = [<<"SADD"/utf8>>, Key],
_pipe@1 = gleam@list:append(_pipe, Values),
radish@utils:prepare(_pipe@1).
-spec card(binary()) -> bitstring().
card(Key) ->
_pipe = [<<"SCARD"/utf8>>, Key],
radish@utils:prepare(_pipe).
-spec is_member(binary(), binary()) -> bitstring().
is_member(Key, Value) ->
_pipe = [<<"SISMEMBER"/utf8>>, Key, Value],
radish@utils:prepare(_pipe).
-spec members(binary()) -> bitstring().
members(Key) ->
_pipe = [<<"SMEMBERS"/utf8>>, Key],
radish@utils:prepare(_pipe).
-spec scan(binary(), integer(), integer()) -> bitstring().
scan(Key, Cursor, Count) ->
_pipe = [<<"SSCAN"/utf8>>,
Key,
gleam@int:to_string(Cursor),
<<"COUNT"/utf8>>,
gleam@int:to_string(Count)],
radish@utils:prepare(_pipe).
-spec scan_pattern(binary(), integer(), binary(), integer()) -> bitstring().
scan_pattern(Key, Cursor, Pattern, Count) ->
_pipe = [<<"SSCAN"/utf8>>,
Key,
gleam@int:to_string(Cursor),
<<"MATCH"/utf8>>,
Pattern,
<<"COUNT"/utf8>>,
gleam@int:to_string(Count)],
radish@utils:prepare(_pipe).