Current section
Files
Jump to
Current section
Files
src/valkyrie@pipeline.erl
-module(valkyrie@pipeline).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/valkyrie/pipeline.gleam").
-export([new/0, exec/3, exec_transaction/3, has_errors/1, to_results/1, keys/2, scan/5, exists/2, get/2, mget/2, append/3, set/4, mset/2, del/2, incr/2, incrby/3, incrbyfloat/3, decr/2, decrby/3, randomkey/1, key_type/2, rename/3, renamenx/3, persist/2, ping/2, expire/4, pexpire/4, expireat/4, expiretime/2, pexpiretime/2, lpush/3, rpush/3, lpushx/3, rpushx/3, llen/2, lrange/4, lpop/3, rpop/3, lindex/3, lrem/4, lset/4, linsert/5, sadd/3, scard/2, sismember/3, smembers/2, sscan/5, zadd/5, zincrby/4, zcard/2, zcount/4, zscore/3, zscan/5, zrem/3, zrandmember/3, zpopmin/3, zpopmax/3, zrange/5, zrange_byscore/5, zrange_bylex/5, zrank/3, zrank_withscore/3, zrevrank/3, zrevrank_withscore/3, hset/3, hsetnx/4, hlen/2, hkeys/2, hget/3, hgetall/2, hmget/3, hstrlen/3, hvals/2, hdel/3, hexists/3, hincrby/4, hincrbyfloat/4, hscan/5]).
-export_type([pipeline/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-opaque pipeline() :: {pipeline, list(list(binary()))}.
-file("src/valkyrie/pipeline.gleam", 18).
?DOC(" Create a new empty pipeline.\n").
-spec new() -> pipeline().
new() ->
{pipeline, []}.
-file("src/valkyrie/pipeline.gleam", 26).
?DOC(
" Execute all commands in the pipeline and return the results.\n"
"\n"
" Returns a list of `resp.Value` for each command in the order they were added.\n"
" Returns `Ok([])` immediately if the pipeline is empty.\n"
).
-spec exec(pipeline(), valkyrie:connection(), integer()) -> {ok,
list(valkyrie@resp:value())} |
{error, valkyrie:error()}.
exec(Pipeline, Conn, Timeout) ->
case erlang:element(2, Pipeline) of
[] ->
{ok, []};
_ ->
valkyrie:execute_bits(
Conn,
begin
_pipe = lists:reverse(erlang:element(2, Pipeline)),
valkyrie@resp:encode_pipeline(_pipe)
end,
Timeout
)
end.
-file("src/valkyrie/pipeline.gleam", 42).
?DOC(
" Execute commands in the pipeline in a Redis transaction with MULTI and EXEC.\n"
"\n"
" Returns a list of `resp.Value` for each command in the order they were added.\n"
" Returns `Ok([])` immediately if the pipeline is empty.\n"
).
-spec exec_transaction(pipeline(), valkyrie:connection(), integer()) -> {ok,
list(valkyrie@resp:value())} |
{error, valkyrie:error()}.
exec_transaction(Pipeline, Conn, Timeout) ->
case erlang:element(2, Pipeline) of
[] ->
{ok, []};
_ ->
With_exec = [[<<"EXEC"/utf8>>] | erlang:element(2, Pipeline)],
With_multi = [[<<"MULTI"/utf8>>] | lists:reverse(With_exec)],
gleam@result:'try'(
valkyrie:execute_bits(
Conn,
valkyrie@resp:encode_pipeline(With_multi),
Timeout
),
fun(Results) -> case gleam@list:last(Results) of
{ok, {array, Exec_results}} ->
{ok, Exec_results};
_ ->
{error,
{resp_error,
<<"Expected EXEC response to be an array"/utf8>>}}
end end
)
end.
-file("src/valkyrie/pipeline.gleam", 84).
?DOC(
" Check if any results from a pipeline or transaction contain errors.\n"
"\n"
" This is useful for quickly determining if any commands failed without\n"
" inspecting each result individually.\n"
"\n"
" ## Example\n"
"\n"
" ```gleam\n"
" let assert Ok(results) = pipeline.exec(p, conn, 1000)\n"
" case pipeline.has_errors(results) {\n"
" True -> io.println(\"Some commands failed\")\n"
" False -> io.println(\"All commands succeeded\")\n"
" }\n"
" ```\n"
).
-spec has_errors(list(valkyrie@resp:value())) -> boolean().
has_errors(Results) ->
gleam@list:any(Results, fun valkyrie@resp:is_error/1).
-file("src/valkyrie/pipeline.gleam", 103).
?DOC(
" Convert a list of pipeline results to a list of Results, turning\n"
" `SimpleError` and `BulkError` values into `Error` variants.\n"
"\n"
" This makes it easier to work with pipeline results using standard\n"
" Result functions like `result.try`, `list.all`, or `result.partition`.\n"
"\n"
" ## Example\n"
"\n"
" ```gleam\n"
" let assert Ok(results) = pipeline.exec(p, conn, 1000)\n"
" let #(successes, failures) =\n"
" results\n"
" |> pipeline.to_results\n"
" |> result.partition\n"
" ```\n"
).
-spec to_results(list(valkyrie@resp:value())) -> list({ok,
valkyrie@resp:value()} |
{error, binary()}).
to_results(Results) ->
gleam@list:map(Results, fun(Value) -> case Value of
{simple_error, Msg} ->
{error, Msg};
{bulk_error, Msg} ->
{error, Msg};
Other ->
{ok, Other}
end end).
-file("src/valkyrie/pipeline.gleam", 117).
?DOC(" Adds KEYS to the pipeline. See [`valkyrie.keys`](/valkyrie.html#keys) for more details.\n").
-spec keys(pipeline(), binary()) -> pipeline().
keys(Pipeline, Pattern) ->
{pipeline,
[valkyrie@internal@commands:keys(Pattern) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 122).
?DOC(" Adds SCAN to the pipeline. See [`valkyrie.scan`](/valkyrie.html#scan) for more details.\n").
-spec scan(
pipeline(),
integer(),
gleam@option:option(binary()),
integer(),
gleam@option:option(valkyrie:key_type())
) -> pipeline().
scan(Pipeline, Cursor, Pattern_filter, Count, Key_type_filter) ->
Command = valkyrie@internal@commands:scan(
Cursor,
Pattern_filter,
Count,
gleam@option:map(Key_type_filter, fun valkyrie:key_type_to_string/1)
),
{pipeline, [Command | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 140).
?DOC(" Adds EXISTS to the pipeline. See [`valkyrie.exists`](/valkyrie.html#exists) for more details.\n").
-spec exists(pipeline(), list(binary())) -> pipeline().
exists(Pipeline, Keys) ->
{pipeline,
[valkyrie@internal@commands:exists(Keys) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 145).
?DOC(" Adds GET to the pipeline. See [`valkyrie.get`](/valkyrie.html#get) for more details.\n").
-spec get(pipeline(), binary()) -> pipeline().
get(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:get(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 150).
?DOC(" Adds MGET to the pipeline. See [`valkyrie.mget`](/valkyrie.html#mget) for more details.\n").
-spec mget(pipeline(), list(binary())) -> pipeline().
mget(Pipeline, Keys) ->
{pipeline,
[valkyrie@internal@commands:mget(Keys) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 155).
?DOC(" Adds APPEND to the pipeline. See [`valkyrie.append`](/valkyrie.html#append) for more details.\n").
-spec append(pipeline(), binary(), binary()) -> pipeline().
append(Pipeline, Key, Value) ->
{pipeline,
[valkyrie@internal@commands:append(Key, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 160).
?DOC(" Adds SET to the pipeline. See [`valkyrie.set`](/valkyrie.html#set) for more details.\n").
-spec set(
pipeline(),
binary(),
binary(),
gleam@option:option(valkyrie:set_options())
) -> pipeline().
set(Pipeline, Key, Value, Options) ->
Modifiers = valkyrie:set_options_to_modifiers(Options),
{pipeline,
[valkyrie@internal@commands:set(Key, Value, Modifiers) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 171).
?DOC(" Adds MSET to the pipeline. See [`valkyrie.mset`](/valkyrie.html#mset) for more details.\n").
-spec mset(pipeline(), list({binary(), binary()})) -> pipeline().
mset(Pipeline, Kv_list) ->
{pipeline,
[valkyrie@internal@commands:mset(Kv_list) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 176).
?DOC(" Adds DEL to the pipeline. See [`valkyrie.del`](/valkyrie.html#del) for more details.\n").
-spec del(pipeline(), list(binary())) -> pipeline().
del(Pipeline, Keys) ->
{pipeline,
[valkyrie@internal@commands:del(Keys) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 181).
?DOC(" Adds INCR to the pipeline. See [`valkyrie.incr`](/valkyrie.html#incr) for more details.\n").
-spec incr(pipeline(), binary()) -> pipeline().
incr(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:incr(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 186).
?DOC(" Adds INCRBY to the pipeline. See [`valkyrie.incrby`](/valkyrie.html#incrby) for more details.\n").
-spec incrby(pipeline(), binary(), integer()) -> pipeline().
incrby(Pipeline, Key, Value) ->
{pipeline,
[valkyrie@internal@commands:incrby(Key, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 191).
?DOC(" Adds INCRBYFLOAT to the pipeline. See [`valkyrie.incrbyfloat`](/valkyrie.html#incrbyfloat) for more details.\n").
-spec incrbyfloat(pipeline(), binary(), float()) -> pipeline().
incrbyfloat(Pipeline, Key, Value) ->
{pipeline,
[valkyrie@internal@commands:incrbyfloat(Key, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 196).
?DOC(" Adds DECR to the pipeline. See [`valkyrie.decr`](/valkyrie.html#decr) for more details.\n").
-spec decr(pipeline(), binary()) -> pipeline().
decr(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:decr(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 201).
?DOC(" Adds DECRBY to the pipeline. See [`valkyrie.decrby`](/valkyrie.html#decrby) for more details.\n").
-spec decrby(pipeline(), binary(), integer()) -> pipeline().
decrby(Pipeline, Key, Value) ->
{pipeline,
[valkyrie@internal@commands:decrby(Key, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 206).
?DOC(" Adds RANDOMKEY to the pipeline. See [`valkyrie.randomkey`](/valkyrie.html#randomkey) for more details.\n").
-spec randomkey(pipeline()) -> pipeline().
randomkey(Pipeline) ->
{pipeline,
[valkyrie@internal@commands:randomkey() | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 211).
?DOC(" Adds TYPE to the pipeline. See [`valkyrie.key_type`](/valkyrie.html#key_type) for more details.\n").
-spec key_type(pipeline(), binary()) -> pipeline().
key_type(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:key_type(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 216).
?DOC(" Adds RENAME to the pipeline. See [`valkyrie.rename`](/valkyrie.html#rename) for more details.\n").
-spec rename(pipeline(), binary(), binary()) -> pipeline().
rename(Pipeline, Key, New_key) ->
{pipeline,
[valkyrie@internal@commands:rename(Key, New_key) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 221).
?DOC(" Adds RENAMENX to the pipeline. See [`valkyrie.renamenx`](/valkyrie.html#renamenx) for more details.\n").
-spec renamenx(pipeline(), binary(), binary()) -> pipeline().
renamenx(Pipeline, Key, New_key) ->
{pipeline,
[valkyrie@internal@commands:renamenx(Key, New_key) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 226).
?DOC(" Adds PERSIST to the pipeline. See [`valkyrie.persist`](/valkyrie.html#persist) for more details.\n").
-spec persist(pipeline(), binary()) -> pipeline().
persist(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:persist(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 231).
?DOC(" Adds PING to the pipeline. See [`valkyrie.ping`](/valkyrie.html#ping) for more details.\n").
-spec ping(pipeline(), gleam@option:option(binary())) -> pipeline().
ping(Pipeline, Message) ->
{pipeline,
[valkyrie@internal@commands:ping(Message) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 236).
?DOC(" Adds EXPIRE to the pipeline. See [`valkyrie.expire`](/valkyrie.html#expire) for more details.\n").
-spec expire(
pipeline(),
binary(),
integer(),
gleam@option:option(valkyrie:expire_condition())
) -> pipeline().
expire(Pipeline, Key, Ttl, Condition) ->
Expiry_condition = valkyrie:expire_condition_to_modifiers(Condition),
{pipeline,
[valkyrie@internal@commands:expire(Key, Ttl, Expiry_condition) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 250).
?DOC(" Adds PEXPIRE to the pipeline. See [`valkyrie.pexpire`](/valkyrie.html#pexpire) for more details.\n").
-spec pexpire(
pipeline(),
binary(),
integer(),
gleam@option:option(valkyrie:expire_condition())
) -> pipeline().
pexpire(Pipeline, Key, Ttl, Condition) ->
Expiry_condition = valkyrie:expire_condition_to_modifiers(Condition),
{pipeline,
[valkyrie@internal@commands:pexpire(Key, Ttl, Expiry_condition) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 264).
?DOC(" Adds EXPIREAT to the pipeline. See [`valkyrie.expireat`](/valkyrie.html#expireat) for more details.\n").
-spec expireat(
pipeline(),
binary(),
integer(),
gleam@option:option(valkyrie:expire_condition())
) -> pipeline().
expireat(Pipeline, Key, Unix_seconds, Condition) ->
Expiry_condition = valkyrie:expire_condition_to_modifiers(Condition),
{pipeline,
[valkyrie@internal@commands:expireat(
Key,
Unix_seconds,
Expiry_condition
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 278).
?DOC(" Adds EXPIRETIME to the pipeline. See [`valkyrie.expiretime`](/valkyrie.html#expiretime) for more details.\n").
-spec expiretime(pipeline(), binary()) -> pipeline().
expiretime(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:expiretime(Key) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 283).
?DOC(" Adds PEXPIRETIME to the pipeline. See [`valkyrie.pexpiretime`](/valkyrie.html#pexpiretime) for more details.\n").
-spec pexpiretime(pipeline(), binary()) -> pipeline().
pexpiretime(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:pexpiretime(Key) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 292).
?DOC(" Adds LPUSH to the pipeline. See [`valkyrie.lpush`](/valkyrie.html#lpush) for more details.\n").
-spec lpush(pipeline(), binary(), list(binary())) -> pipeline().
lpush(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:lpush(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 297).
?DOC(" Adds RPUSH to the pipeline. See [`valkyrie.rpush`](/valkyrie.html#rpush) for more details.\n").
-spec rpush(pipeline(), binary(), list(binary())) -> pipeline().
rpush(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:rpush(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 302).
?DOC(" Adds LPUSHX to the pipeline. See [`valkyrie.lpushx`](/valkyrie.html#lpushx) for more details.\n").
-spec lpushx(pipeline(), binary(), list(binary())) -> pipeline().
lpushx(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:lpushx(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 307).
?DOC(" Adds RPUSHX to the pipeline. See [`valkyrie.rpushx`](/valkyrie.html#rpushx) for more details.\n").
-spec rpushx(pipeline(), binary(), list(binary())) -> pipeline().
rpushx(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:rpushx(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 312).
?DOC(" Adds LLEN to the pipeline. See [`valkyrie.llen`](/valkyrie.html#llen) for more details.\n").
-spec llen(pipeline(), binary()) -> pipeline().
llen(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:llen(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 317).
?DOC(" Adds LRANGE to the pipeline. See [`valkyrie.lrange`](/valkyrie.html#lrange) for more details.\n").
-spec lrange(pipeline(), binary(), integer(), integer()) -> pipeline().
lrange(Pipeline, Key, Start, End) ->
{pipeline,
[valkyrie@internal@commands:lrange(Key, Start, End) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 322).
?DOC(" Adds LPOP to the pipeline. See [`valkyrie.lpop`](/valkyrie.html#lpop) for more details.\n").
-spec lpop(pipeline(), binary(), integer()) -> pipeline().
lpop(Pipeline, Key, Count) ->
{pipeline,
[valkyrie@internal@commands:lpop(Key, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 327).
?DOC(" Adds RPOP to the pipeline. See [`valkyrie.rpop`](/valkyrie.html#rpop) for more details.\n").
-spec rpop(pipeline(), binary(), integer()) -> pipeline().
rpop(Pipeline, Key, Count) ->
{pipeline,
[valkyrie@internal@commands:rpop(Key, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 332).
?DOC(" Adds LINDEX to the pipeline. See [`valkyrie.lindex`](/valkyrie.html#lindex) for more details.\n").
-spec lindex(pipeline(), binary(), integer()) -> pipeline().
lindex(Pipeline, Key, Index) ->
{pipeline,
[valkyrie@internal@commands:lindex(Key, Index) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 337).
?DOC(" Adds LREM to the pipeline. See [`valkyrie.lrem`](/valkyrie.html#lrem) for more details.\n").
-spec lrem(pipeline(), binary(), integer(), binary()) -> pipeline().
lrem(Pipeline, Key, Count, Value) ->
{pipeline,
[valkyrie@internal@commands:lrem(Key, Count, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 347).
?DOC(" Adds LSET to the pipeline. See [`valkyrie.lset`](/valkyrie.html#lset) for more details.\n").
-spec lset(pipeline(), binary(), integer(), binary()) -> pipeline().
lset(Pipeline, Key, Index, Value) ->
{pipeline,
[valkyrie@internal@commands:lset(Key, Index, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 357).
?DOC(" Adds LINSERT to the pipeline. See [`valkyrie.linsert`](/valkyrie.html#linsert) for more details.\n").
-spec linsert(
pipeline(),
binary(),
valkyrie:insert_position(),
binary(),
binary()
) -> pipeline().
linsert(Pipeline, Key, Position, Pivot, Value) ->
Position_str = valkyrie:insert_position_to_string(Position),
{pipeline,
[valkyrie@internal@commands:linsert(Key, Position_str, Pivot, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 376).
?DOC(" Adds SADD to the pipeline. See [`valkyrie.sadd`](/valkyrie.html#sadd) for more details.\n").
-spec sadd(pipeline(), binary(), list(binary())) -> pipeline().
sadd(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:sadd(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 381).
?DOC(" Adds SCARD to the pipeline. See [`valkyrie.scard`](/valkyrie.html#scard) for more details.\n").
-spec scard(pipeline(), binary()) -> pipeline().
scard(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:scard(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 386).
?DOC(" Adds SISMEMBER to the pipeline. See [`valkyrie.sismember`](/valkyrie.html#sismember) for more details.\n").
-spec sismember(pipeline(), binary(), binary()) -> pipeline().
sismember(Pipeline, Key, Value) ->
{pipeline,
[valkyrie@internal@commands:sismember(Key, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 391).
?DOC(" Adds SMEMBERS to the pipeline. See [`valkyrie.smembers`](/valkyrie.html#smembers) for more details.\n").
-spec smembers(pipeline(), binary()) -> pipeline().
smembers(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:smembers(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 396).
?DOC(" Adds SSCAN to the pipeline. See [`valkyrie.sscan`](/valkyrie.html#sscan) for more details.\n").
-spec sscan(
pipeline(),
binary(),
integer(),
gleam@option:option(binary()),
integer()
) -> pipeline().
sscan(Pipeline, Key, Cursor, Pattern_filter, Count) ->
{pipeline,
[valkyrie@internal@commands:sscan(Key, Cursor, Pattern_filter, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 414).
?DOC(" Adds ZADD to the pipeline. See [`valkyrie.zadd`](/valkyrie.html#zadd) for more details.\n").
-spec zadd(
pipeline(),
binary(),
list({binary(), valkyrie:score()}),
valkyrie:z_add_condition(),
boolean()
) -> pipeline().
zadd(Pipeline, Key, Members, Condition, Return_changed) ->
Modifiers_and_members = valkyrie:zadd_build_modifiers_and_members(
Members,
Condition,
Return_changed
),
{pipeline,
[valkyrie@internal@commands:zadd(Key, Modifiers_and_members) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 434).
?DOC(" Adds ZINCRBY to the pipeline. See [`valkyrie.zincrby`](/valkyrie.html#zincrby) for more details.\n").
-spec zincrby(pipeline(), binary(), binary(), valkyrie:score()) -> pipeline().
zincrby(Pipeline, Key, Member, Delta) ->
{pipeline,
[valkyrie@internal@commands:zincrby(
Key,
valkyrie:score_to_string(Delta),
Member
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 447).
?DOC(" Adds ZCARD to the pipeline. See [`valkyrie.zcard`](/valkyrie.html#zcard) for more details.\n").
-spec zcard(pipeline(), binary()) -> pipeline().
zcard(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:zcard(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 452).
?DOC(" Adds ZCOUNT to the pipeline. See [`valkyrie.zcount`](/valkyrie.html#zcount) for more details.\n").
-spec zcount(pipeline(), binary(), valkyrie:score(), valkyrie:score()) -> pipeline().
zcount(Pipeline, Key, Min, Max) ->
{pipeline,
[valkyrie@internal@commands:zcount(
Key,
valkyrie:score_to_string(Min),
valkyrie:score_to_string(Max)
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 469).
?DOC(" Adds ZSCORE to the pipeline. See [`valkyrie.zscore`](/valkyrie.html#zscore) for more details.\n").
-spec zscore(pipeline(), binary(), binary()) -> pipeline().
zscore(Pipeline, Key, Member) ->
{pipeline,
[valkyrie@internal@commands:zscore(Key, Member) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 474).
?DOC(" Adds ZSCAN to the pipeline. See [`valkyrie.zscan`](/valkyrie.html#zscan) for more details.\n").
-spec zscan(
pipeline(),
binary(),
integer(),
gleam@option:option(binary()),
integer()
) -> pipeline().
zscan(Pipeline, Key, Cursor, Pattern_filter, Count) ->
{pipeline,
[valkyrie@internal@commands:zscan(Key, Cursor, Pattern_filter, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 488).
?DOC(" Adds ZREM to the pipeline. See [`valkyrie.zrem`](/valkyrie.html#zrem) for more details.\n").
-spec zrem(pipeline(), binary(), list(binary())) -> pipeline().
zrem(Pipeline, Key, Members) ->
{pipeline,
[valkyrie@internal@commands:zrem(Key, Members) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 493).
?DOC(" Adds ZRANDMEMBER to the pipeline. See [`valkyrie.zrandmember`](/valkyrie.html#zrandmember) for more details.\n").
-spec zrandmember(pipeline(), binary(), integer()) -> pipeline().
zrandmember(Pipeline, Key, Count) ->
{pipeline,
[valkyrie@internal@commands:zrandmember(Key, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 498).
?DOC(" Adds ZPOPMIN to the pipeline. See [`valkyrie.zpopmin`](/valkyrie.html#zpopmin) for more details.\n").
-spec zpopmin(pipeline(), binary(), integer()) -> pipeline().
zpopmin(Pipeline, Key, Count) ->
{pipeline,
[valkyrie@internal@commands:zpopmin(Key, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 503).
?DOC(" Adds ZPOPMAX to the pipeline. See [`valkyrie.zpopmax`](/valkyrie.html#zpopmax) for more details.\n").
-spec zpopmax(pipeline(), binary(), integer()) -> pipeline().
zpopmax(Pipeline, Key, Count) ->
{pipeline,
[valkyrie@internal@commands:zpopmax(Key, Count) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 508).
?DOC(" Adds ZRANGE to the pipeline. See [`valkyrie.zrange`](/valkyrie.html#zrange) for more details.\n").
-spec zrange(
pipeline(),
binary(),
valkyrie:numeric_bound(integer()),
valkyrie:numeric_bound(integer()),
boolean()
) -> pipeline().
zrange(Pipeline, Key, Start, Stop, Reverse) ->
Modifiers = case Reverse of
true ->
[<<"REV"/utf8>>, <<"WITHSCORES"/utf8>>];
false ->
[<<"WITHSCORES"/utf8>>]
end,
{pipeline,
[valkyrie@internal@commands:zrange(
Key,
valkyrie:numeric_bound_to_string(
Start,
fun erlang:integer_to_binary/1
),
valkyrie:numeric_bound_to_string(
Stop,
fun erlang:integer_to_binary/1
),
Modifiers
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 531).
?DOC(" Adds ZRANGE BYSCORE to the pipeline. See [`valkyrie.zrange_byscore`](/valkyrie.html#zrange_byscore) for more details.\n").
-spec zrange_byscore(
pipeline(),
binary(),
valkyrie:numeric_bound(valkyrie:score()),
valkyrie:numeric_bound(valkyrie:score()),
boolean()
) -> pipeline().
zrange_byscore(Pipeline, Key, Start, Stop, Reverse) ->
Modifiers = case Reverse of
true ->
[<<"BYSCORE"/utf8>>, <<"REV"/utf8>>, <<"WITHSCORES"/utf8>>];
false ->
[<<"BYSCORE"/utf8>>, <<"WITHSCORES"/utf8>>]
end,
{pipeline,
[valkyrie@internal@commands:zrange(
Key,
valkyrie:numeric_bound_to_string(
Start,
fun valkyrie:score_to_string/1
),
valkyrie:numeric_bound_to_string(
Stop,
fun valkyrie:score_to_string/1
),
Modifiers
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 554).
?DOC(" Adds ZRANGE BYLEX to the pipeline. See [`valkyrie.zrange_bylex`](/valkyrie.html#zrange_bylex) for more details.\n").
-spec zrange_bylex(
pipeline(),
binary(),
valkyrie:lex_bound(),
valkyrie:lex_bound(),
boolean()
) -> pipeline().
zrange_bylex(Pipeline, Key, Start, Stop, Reverse) ->
Modifiers = case Reverse of
true ->
[<<"BYLEX"/utf8>>, <<"REV"/utf8>>];
false ->
[<<"BYLEX"/utf8>>]
end,
{pipeline,
[valkyrie@internal@commands:zrange(
Key,
valkyrie:lex_bound_to_string(Start),
valkyrie:lex_bound_to_string(Stop),
Modifiers
) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 577).
?DOC(" Adds ZRANK to the pipeline. See [`valkyrie.zrank`](/valkyrie.html#zrank) for more details.\n").
-spec zrank(pipeline(), binary(), binary()) -> pipeline().
zrank(Pipeline, Key, Member) ->
{pipeline,
[valkyrie@internal@commands:zrank(Key, Member) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 582).
?DOC(" Adds ZRANK WITHSCORE to the pipeline. See [`valkyrie.zrank_withscore`](/valkyrie.html#zrank_withscore) for more details.\n").
-spec zrank_withscore(pipeline(), binary(), binary()) -> pipeline().
zrank_withscore(Pipeline, Key, Member) ->
{pipeline,
[valkyrie@internal@commands:zrank_withscore(Key, Member) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 594).
?DOC(" Adds ZREVRANK to the pipeline. See [`valkyrie.zrevrank`](/valkyrie.html#zrevrank) for more details.\n").
-spec zrevrank(pipeline(), binary(), binary()) -> pipeline().
zrevrank(Pipeline, Key, Member) ->
{pipeline,
[valkyrie@internal@commands:zrevrank(Key, Member) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 599).
?DOC(" Adds ZREVRANK WITHSCORE to the pipeline. See [`valkyrie.zrevrank_withscore`](/valkyrie.html#zrevrank_withscore) for more details.\n").
-spec zrevrank_withscore(pipeline(), binary(), binary()) -> pipeline().
zrevrank_withscore(Pipeline, Key, Member) ->
{pipeline,
[valkyrie@internal@commands:zrevrank_withscore(Key, Member) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 615).
?DOC(" Adds HSET to the pipeline. See [`valkyrie.hset`](/valkyrie.html#hset) for more details.\n").
-spec hset(pipeline(), binary(), gleam@dict:dict(binary(), binary())) -> pipeline().
hset(Pipeline, Key, Values) ->
{pipeline,
[valkyrie@internal@commands:hset(Key, Values) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 624).
?DOC(" Adds HSETNX to the pipeline. See [`valkyrie.hsetnx`](/valkyrie.html#hsetnx) for more details.\n").
-spec hsetnx(pipeline(), binary(), binary(), binary()) -> pipeline().
hsetnx(Pipeline, Key, Field, Value) ->
{pipeline,
[valkyrie@internal@commands:hsetnx(Key, Field, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 634).
?DOC(" Adds HLEN to the pipeline. See [`valkyrie.hlen`](/valkyrie.html#hlen) for more details.\n").
-spec hlen(pipeline(), binary()) -> pipeline().
hlen(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:hlen(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 639).
?DOC(" Adds HKEYS to the pipeline. See [`valkyrie.hkeys`](/valkyrie.html#hkeys) for more details.\n").
-spec hkeys(pipeline(), binary()) -> pipeline().
hkeys(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:hkeys(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 644).
?DOC(" Adds HGET to the pipeline. See [`valkyrie.hget`](/valkyrie.html#hget) for more details.\n").
-spec hget(pipeline(), binary(), binary()) -> pipeline().
hget(Pipeline, Key, Field) ->
{pipeline,
[valkyrie@internal@commands:hget(Key, Field) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 649).
?DOC(" Adds HGETALL to the pipeline. See [`valkyrie.hgetall`](/valkyrie.html#hgetall) for more details.\n").
-spec hgetall(pipeline(), binary()) -> pipeline().
hgetall(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:hgetall(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 654).
?DOC(" Adds HMGET to the pipeline. See [`valkyrie.hmget`](/valkyrie.html#hmget) for more details.\n").
-spec hmget(pipeline(), binary(), list(binary())) -> pipeline().
hmget(Pipeline, Key, Fields) ->
{pipeline,
[valkyrie@internal@commands:hmget(Key, Fields) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 659).
?DOC(" Adds HSTRLEN to the pipeline. See [`valkyrie.hstrlen`](/valkyrie.html#hstrlen) for more details.\n").
-spec hstrlen(pipeline(), binary(), binary()) -> pipeline().
hstrlen(Pipeline, Key, Field) ->
{pipeline,
[valkyrie@internal@commands:hstrlen(Key, Field) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 664).
?DOC(" Adds HVALS to the pipeline. See [`valkyrie.hvals`](/valkyrie.html#hvals) for more details.\n").
-spec hvals(pipeline(), binary()) -> pipeline().
hvals(Pipeline, Key) ->
{pipeline,
[valkyrie@internal@commands:hvals(Key) | erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 669).
?DOC(" Adds HDEL to the pipeline. See [`valkyrie.hdel`](/valkyrie.html#hdel) for more details.\n").
-spec hdel(pipeline(), binary(), list(binary())) -> pipeline().
hdel(Pipeline, Key, Fields) ->
{pipeline,
[valkyrie@internal@commands:hdel(Key, Fields) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 674).
?DOC(" Adds HEXISTS to the pipeline. See [`valkyrie.hexists`](/valkyrie.html#hexists) for more details.\n").
-spec hexists(pipeline(), binary(), binary()) -> pipeline().
hexists(Pipeline, Key, Field) ->
{pipeline,
[valkyrie@internal@commands:hexists(Key, Field) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 679).
?DOC(" Adds HINCRBY to the pipeline. See [`valkyrie.hincrby`](/valkyrie.html#hincrby) for more details.\n").
-spec hincrby(pipeline(), binary(), binary(), integer()) -> pipeline().
hincrby(Pipeline, Key, Field, Value) ->
{pipeline,
[valkyrie@internal@commands:hincrby(Key, Field, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 689).
?DOC(" Adds HINCRBYFLOAT to the pipeline. See [`valkyrie.hincrbyfloat`](/valkyrie.html#hincrbyfloat) for more details.\n").
-spec hincrbyfloat(pipeline(), binary(), binary(), float()) -> pipeline().
hincrbyfloat(Pipeline, Key, Field, Value) ->
{pipeline,
[valkyrie@internal@commands:hincrbyfloat(Key, Field, Value) |
erlang:element(2, Pipeline)]}.
-file("src/valkyrie/pipeline.gleam", 702).
?DOC(" Adds HSCAN to the pipeline. See [`valkyrie.hscan`](/valkyrie.html#hscan) for more details.\n").
-spec hscan(
pipeline(),
binary(),
integer(),
gleam@option:option(binary()),
integer()
) -> pipeline().
hscan(Pipeline, Key, Cursor, Pattern_filter, Count) ->
{pipeline,
[valkyrie@internal@commands:hscan(Key, Cursor, Pattern_filter, Count) |
erlang:element(2, Pipeline)]}.