Current section

Files

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

src/radish@command@pub_sub.erl

-module(radish@command@pub_sub).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function]).
-export([publish/2, subscribe/1, subscribe_to_patterns/1, unsubscribe/1, unsubscribe_from_all/0, unsubscribe_from_patterns/1, unsubscribe_from_all_patterns/0]).
-spec publish(binary(), binary()) -> bitstring().
publish(Channel, Message) ->
_pipe = [<<"PUBLISH"/utf8>>, Channel, Message],
radish@utils:prepare(_pipe).
-spec subscribe(list(binary())) -> bitstring().
subscribe(Channels) ->
_pipe = [<<"SUBSCRIBE"/utf8>>],
_pipe@1 = gleam@list:append(_pipe, Channels),
radish@utils:prepare(_pipe@1).
-spec subscribe_to_patterns(list(binary())) -> bitstring().
subscribe_to_patterns(Patterns) ->
_pipe = [<<"PSUBSCRIBE"/utf8>>],
_pipe@1 = gleam@list:append(_pipe, Patterns),
radish@utils:prepare(_pipe@1).
-spec unsubscribe(list(binary())) -> bitstring().
unsubscribe(Channels) ->
_pipe = [<<"UNSUBSCRIBE"/utf8>>],
_pipe@1 = gleam@list:append(_pipe, Channels),
radish@utils:prepare(_pipe@1).
-spec unsubscribe_from_all() -> bitstring().
unsubscribe_from_all() ->
_pipe = [<<"UNSUBSCRIBE"/utf8>>],
radish@utils:prepare(_pipe).
-spec unsubscribe_from_patterns(list(binary())) -> bitstring().
unsubscribe_from_patterns(Patterns) ->
_pipe = [<<"PUNSUBSCRIBE"/utf8>>],
_pipe@1 = gleam@list:append(_pipe, Patterns),
radish@utils:prepare(_pipe@1).
-spec unsubscribe_from_all_patterns() -> bitstring().
unsubscribe_from_all_patterns() ->
_pipe = [<<"PUNSUBSCRIBE"/utf8>>],
radish@utils:prepare(_pipe).