Types
use variant value
from componentized:valkey/resp
string:stringerror:stringinteger:s64bulk-string:stringarray:list<nested-value>nullboolean:booldouble:f64big-number:stringbulk-error:stringverbatim-string:tuple<string, string>map:list<tuple<nested-value, nested-value>>set:list<nested-value>push:list<nested-value>
variant error
client:stringClient errors can represent semantic issues with input/output values, or connection errors communicating with the server
resp:resp-errorRESP errors are encoding issues converting values to/from bytes
valkey:stringValkey errors are Error or BulkError values returned directly from the server
record hello-opts
proto-ver:option<string>auth:option<tuple<string, string>>client-name:option<string>
record hrandfield-opts
count:option<s64>with-values:option<bool>
record hscan-opts
match:option<string>count:option<s64>no-values:option<bool>
resource connection
acl-deluser: func(username: string) -> result<_, error>acl-genpass: func() -> result<string, error>acl-setuser: func( username: string, rules: list<string>, ) -> result<_, error>auth: func(username: string, password: string) -> result<_, error>del: func(key: string) -> result<_, error>exists: func(key: string) -> result<bool, error>get: func(key: string) -> result<option<string>, error>hdel: func(key: string, field: string) -> result<_, error>hello: func( opts: option<hello-opts>, ) -> result<list<tuple<string, value>>, error>hexists: func(key: string, field: string) -> result<bool, error>hget: func(key: string, field: string) -> result<option<string>, error>hgetall: func(key: string) -> result<list<tuple<string, string>>, error>hincrby: func( key: string, field: string, increment: s64, ) -> result<s64, error>hincrbyfloat: func( key: string, field: string, increment: f64, ) -> result<string, error>hkeys: func(key: string) -> result<list<string>, error>hlen: func(key: string) -> result<u64, error>hmget: func( key: string, fields: list<string>, ) -> result<list<option<string>>, error>hmset: func( key: string, fields: list<tuple<string, string>>, ) -> result<_, error>hrandfield: func( key: string, opts: option<hrandfield-opts>, ) -> result<option<list<tuple<string, option<string>>>>, error>hscan: func( key: string, cursor: option<string>, opts: option<hscan-opts>, ) -> result<tuple<option<string>, list<tuple<string, option<string>>>>, error>hset: func( key: string, field: string, value: string, ) -> result<_, error>hsetnx: func( key: string, field: string, value: string, ) -> result<bool, error>hstrlen: func(key: string, field: string) -> result<u64, error>hvals: func(key: string) -> result<list<string>, error>incr: func(key: string) -> result<s64, error>incrby: func(key: string, increment: s64) -> result<s64, error>keys: func(pattern: string) -> result<list<string>, error>ping: func() -> result<_, error>publish: func(channel: string, message: string) -> result<s64, error>quit: func() -> result<_, error>set: func(key: string, value: string) -> result<_, error>
Functions
connect: func(
host: string,
port: u16,
opts: option<hello-opts>,
) -> result<connection, error>
WIT
interface store {
use resp.{error as resp-error, value};
variant error {
/// Client errors can represent semantic issues with input/output values, or connection errors communicating with the server
client(string),
/// RESP errors are encoding issues converting values to/from bytes
resp(resp-error),
/// Valkey errors are Error or BulkError values returned directly from the server
valkey(string),
}
record hello-opts {
proto-ver: option<string>,
auth: option<tuple<string, string>>,
client-name: option<string>,
}
record hrandfield-opts {
count: option<s64>,
with-values: option<bool>,
}
record hscan-opts {
match: option<string>,
count: option<s64>,
no-values: option<bool>,
}
resource connection {
send: func(command: list<value>) -> result<value, error>;
acl-deluser: func(username: string) -> result<_, error>;
acl-genpass: func() -> result<string, error>;
acl-setuser: func(username: string, rules: list<string>) -> result<_, error>;
auth: func(username: string, password: string) -> result<_, error>;
del: func(key: string) -> result<_, error>;
exists: func(key: string) -> result<bool, error>;
get: func(key: string) -> result<option<string>, error>;
hdel: func(key: string, field: string) -> result<_, error>;
hello: func(opts: option<hello-opts>) -> result<list<tuple<string, value>>, error>;
hexists: func(key: string, field: string) -> result<bool, error>;
hget: func(key: string, field: string) -> result<option<string>, error>;
hgetall: func(key: string) -> result<list<tuple<string, string>>, error>;
hincrby: func(key: string, field: string, increment: s64) -> result<s64, error>;
hincrbyfloat: func(key: string, field: string, increment: f64) -> result<string, error>;
hkeys: func(key: string) -> result<list<string>, error>;
hlen: func(key: string) -> result<u64, error>;
hmget: func(key: string, fields: list<string>) -> result<list<option<string>>, error>;
hmset: func(key: string, fields: list<tuple<string, string>>) -> result<_, error>;
hrandfield: func(key: string, opts: option<hrandfield-opts>) -> result<option<list<tuple<string, option<string>>>>, error>;
hscan: func(key: string, cursor: option<string>, opts: option<hscan-opts>) -> result<tuple<option<string>, list<tuple<string, option<string>>>>, error>;
hset: func(key: string, field: string, value: string) -> result<_, error>;
hsetnx: func(key: string, field: string, value: string) -> result<bool, error>;
hstrlen: func(key: string, field: string) -> result<u64, error>;
hvals: func(key: string) -> result<list<string>, error>;
incr: func(key: string) -> result<s64, error>;
incrby: func(key: string, increment: s64) -> result<s64, error>;
keys: func(pattern: string) -> result<list<string>, error>;
ping: func() -> result<_, error>;
publish: func(channel: string, message: string) -> result<s64, error>;
quit: func() -> result<_, error>;
set: func(key: string, value: string) -> result<_, error>;
}
connect: func(host: string, port: u16, opts: option<hello-opts>) -> result<connection, error>;
}