API
#github.com/xulang-org/packages/redis
Xu 0.8.8 API
import: redis #github.com/xulang-org/packages/redis
counts: 18 fns, 91 methods, 5 types, 12 consts, 0 ifaces
Redis standalone client package for Xu. Features Full RESP2 / RESP3 protocol support. High-performance socket line & bulk byte buffering. Easy-to-use API for strings, hashes, lists, sets, sorted sets, and batch operations. Pipelining for high-throughput batch operations. Connection pooling support via channels. Full URL format parsing (redis://:password@host:port/db).
github.com/xulang-org/packages · 0.1.1 · Install and use
open
pub fn open(addr string) Client
Purpose
Redis standalone client package for Xu. Features Full RESP2 / RESP3 protocol support. High-performance socket line & bulk byte buffering. Easy-to-use API for strings, hashes, lists, sets, sorted sets, and batch operations. Pipelining for high-throughput batch operations. Connection pooling support via channels. Full URL format parsing (redis://:password@host:port/db). Throws on failure.
Parameters
addr string- address (string)
Returns
Client — a value of this type
open_auth
pub fn open_auth(addr string, password string) Client
Purpose
Open auth. Throws on failure.
Parameters
addr string- address (string)
password string- password (string)
Returns
Client — a value of this type
open_url
pub fn open_url(raw string) Client
Purpose
Open url. Throws on failure.
Parameters
raw string- raw (string)
Returns
Client — a value of this type
dial_url
pub fn dial_url(raw string) Client
Purpose
Dial url. Throws on failure.
Parameters
raw string- raw (string)
Returns
Client — a value of this type
struct Client
pub struct Client {
pub fd int
pub buf string
pub addr string
}
Purpose
Public struct `Client`.
Parameters
fd int- file descriptor
buf string- buffer
addr string- address
dial
pub fn dial(addr string) Client
Purpose
Dial a connection. Throws on failure.
Parameters
addr string- address (string)
Returns
Client — a value of this type
(&mut Client) read_line
pub fn (c &mut Client) read_line() string
Purpose
Method on `&mut Client`: read line. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
Returns
string — result string
(&mut Client) read_bytes
pub fn (c &mut Client) read_bytes(n int) string
Purpose
Method on `&mut Client`: read through delim (inclusive). Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
n int- count, length, or limit (int)
Returns
string — result string
(&mut Client) read_value
pub fn (c &mut Client) read_value() Value
Purpose
Method on `&mut Client`: read value. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
Returns
Value — a value of this type
(&mut Client) write_raw
pub fn (c &mut Client) write_raw(data string) int
Purpose
Method on `&mut Client`: write raw. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
data string- data (string)
Returns
int — a value of this type
(&mut Client) do
pub fn (c &mut Client) do(args []string) Value
Purpose
Call `do` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
args []string- variadic arguments ([]string)
Returns
Value — a value of this type
(&mut Client) auth
pub fn (c &mut Client) auth(password string) string
Purpose
Call `auth` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
password string- password (string)
Returns
string — result string
(&mut Client) select_db
pub fn (c &mut Client) select_db(index int) string
Purpose
Method on `&mut Client`: select db. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
index int- index (int)
Returns
string — result string
(&mut Client) close
pub fn (c &mut Client) close() int
Purpose
Method on `&mut Client`: close the resource.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
Returns
int — a value of this type
(&mut Client) ping
pub fn (c &mut Client) ping() string
Purpose
Call `ping` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
Returns
string — result string
(&mut Client) echo
pub fn (c &mut Client) echo(msg string) string
Purpose
Call `echo` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
msg string- message (string)
Returns
string — result string
(&mut Client) get
pub fn (c &mut Client) get(key string) string
Purpose
Call `get` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
string — result string
(&mut Client) set
pub fn (c &mut Client) set(key string, val string) string
Purpose
Call `set` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
val string- value (string)
Returns
string — result string
(&mut Client) set_ex
pub fn (c &mut Client) set_ex(key string, seconds int, val string) string
Purpose
Method on `&mut Client`: set ex. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
seconds int- seconds (int)
val string- value (string)
Returns
string — result string
(&mut Client) del
pub fn (c &mut Client) del(key string) int
Purpose
Call `del` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) del_many
pub fn (c &mut Client) del_many(keys []string) int
Purpose
Method on `&mut Client`: del many. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
keys []string- keys ([]string)
Returns
int — a value of this type
(&mut Client) exists
pub fn (c &mut Client) exists(key string) bool
Purpose
Call `exists` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
bool — true or false
(&mut Client) incr
pub fn (c &mut Client) incr(key string) int
Purpose
Call `incr` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) decr
pub fn (c &mut Client) decr(key string) int
Purpose
Call `decr` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) incr_by
pub fn (c &mut Client) incr_by(key string, delta int) int
Purpose
Method on `&mut Client`: incr by. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
delta int- delta (int)
Returns
int — a value of this type
(&mut Client) decr_by
pub fn (c &mut Client) decr_by(key string, delta int) int
Purpose
Method on `&mut Client`: decr by. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
delta int- delta (int)
Returns
int — a value of this type
(&mut Client) expire
pub fn (c &mut Client) expire(key string, seconds int) bool
Purpose
Call `expire` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
seconds int- seconds (int)
Returns
bool — true or false
(&mut Client) ttl
pub fn (c &mut Client) ttl(key string) int
Purpose
Call `ttl` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) keys
pub fn (c &mut Client) keys(pattern string) []string
Purpose
Call `keys` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
pattern string- pattern (string)
Returns
[]string — slice result
(&mut Client) hget
pub fn (c &mut Client) hget(key string, field string) string
Purpose
Hash operations Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
field string- field (string)
Returns
string — result string
(&mut Client) hset
pub fn (c &mut Client) hset(key string, field string, val string) int
Purpose
Call `hset` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
field string- field (string)
val string- value (string)
Returns
int — a value of this type
(&mut Client) hdel
pub fn (c &mut Client) hdel(key string, field string) int
Purpose
Call `hdel` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
field string- field (string)
Returns
int — a value of this type
(&mut Client) hexists
pub fn (c &mut Client) hexists(key string, field string) bool
Purpose
Call `hexists` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
field string- field (string)
Returns
bool — true or false
(&mut Client) hgetall
pub fn (c &mut Client) hgetall(key string) []string
Purpose
Call `hgetall` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
[]string — slice result
(&mut Client) hkeys
pub fn (c &mut Client) hkeys(key string) []string
Purpose
Call `hkeys` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
[]string — slice result
(&mut Client) hlen
pub fn (c &mut Client) hlen(key string) int
Purpose
Call `hlen` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) lpush
pub fn (c &mut Client) lpush(key string, val string) int
Purpose
List operations Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
val string- value (string)
Returns
int — a value of this type
(&mut Client) rpush
pub fn (c &mut Client) rpush(key string, val string) int
Purpose
Call `rpush` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
val string- value (string)
Returns
int — a value of this type
(&mut Client) lpop
pub fn (c &mut Client) lpop(key string) string
Purpose
Call `lpop` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
string — result string
(&mut Client) rpop
pub fn (c &mut Client) rpop(key string) string
Purpose
Call `rpop` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
string — result string
(&mut Client) llen
pub fn (c &mut Client) llen(key string) int
Purpose
Call `llen` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) lrange
pub fn (c &mut Client) lrange(key string, start int, stop int) []string
Purpose
Call `lrange` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
start int- start (int)
stop int- stop (int)
Returns
[]string — slice result
(&mut Client) sadd
pub fn (c &mut Client) sadd(key string, member string) int
Purpose
Set operations Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
member string- member (string)
Returns
int — a value of this type
(&mut Client) srem
pub fn (c &mut Client) srem(key string, member string) int
Purpose
Call `srem` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
member string- member (string)
Returns
int — a value of this type
(&mut Client) sismember
pub fn (c &mut Client) sismember(key string, member string) bool
Purpose
Call `sismember` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
member string- member (string)
Returns
bool — true or false
(&mut Client) smembers
pub fn (c &mut Client) smembers(key string) []string
Purpose
Call `smembers` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
[]string — slice result
(&mut Client) scard
pub fn (c &mut Client) scard(key string) int
Purpose
Call `scard` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
(&mut Client) mget
pub fn (c &mut Client) mget(keys []string) []string
Purpose
Batch operations Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
keys []string- keys ([]string)
Returns
[]string — slice result
(&mut Client) mset
pub fn (c &mut Client) mset(pairs []string) string
Purpose
Call `mset` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
pairs []string- pairs ([]string)
Returns
string — result string
(&mut Client) zadd
pub fn (c &mut Client) zadd(key string, score f64, member string) int
Purpose
Sorted Set (ZSet) operations Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
score f64- score (f64)
member string- member (string)
Returns
int — a value of this type
(&mut Client) zrange
pub fn (c &mut Client) zrange(key string, start int, stop int) []string
Purpose
Call `zrange` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
start int- start (int)
stop int- stop (int)
Returns
[]string — slice result
(&mut Client) zrevrange
pub fn (c &mut Client) zrevrange(key string, start int, stop int) []string
Purpose
Call `zrevrange` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
start int- start (int)
stop int- stop (int)
Returns
[]string — slice result
(&mut Client) zscore
pub fn (c &mut Client) zscore(key string, member string) string
Purpose
Call `zscore` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
member string- member (string)
Returns
string — result string
(&mut Client) zrem
pub fn (c &mut Client) zrem(key string, member string) int
Purpose
Call `zrem` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
member string- member (string)
Returns
int — a value of this type
(&mut Client) zcard
pub fn (c &mut Client) zcard(key string) int
Purpose
Call `zcard` on `&mut Client`. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
key string- key (string)
Returns
int — a value of this type
struct Pipeline
pub struct Pipeline {
pub raw string
pub count int
}
Purpose
Public struct `Pipeline`.
Parameters
raw string- field (string)
count int- field (int)
new_pipeline
pub fn new_pipeline() Pipeline
Purpose
Construct pipeline.
Parameters
none
Returns
Pipeline — a value of this type
(&Client) pipeline
pub fn (c &Client) pipeline() Pipeline
Purpose
Call `pipeline` on `&Client`.
Parameters
c &Client- receiver &Client (borrow)
Returns
Pipeline — a value of this type
(&mut Pipeline) len
pub fn (p &mut Pipeline) len() int
Purpose
Method on `&mut Pipeline`: return the length.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
Returns
int — a value of this type
(&mut Pipeline) command
pub fn (p &mut Pipeline) command(args []string)
Purpose
Call `command` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
args []string- variadic arguments ([]string)
(&mut Pipeline) ping
pub fn (p &mut Pipeline) ping()
Purpose
Call `ping` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
(&mut Pipeline) get
pub fn (p &mut Pipeline) get(key string)
Purpose
Call `get` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) set
pub fn (p &mut Pipeline) set(key string, val string)
Purpose
Call `set` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
val string- value (string)
(&mut Pipeline) set_ex
pub fn (p &mut Pipeline) set_ex(key string, seconds int, val string)
Purpose
Method on `&mut Pipeline`: set ex.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
seconds int- seconds (int)
val string- value (string)
(&mut Pipeline) del
pub fn (p &mut Pipeline) del(key string)
Purpose
Call `del` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) incr
pub fn (p &mut Pipeline) incr(key string)
Purpose
Call `incr` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) decr
pub fn (p &mut Pipeline) decr(key string)
Purpose
Call `decr` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) incr_by
pub fn (p &mut Pipeline) incr_by(key string, delta int)
Purpose
Method on `&mut Pipeline`: incr by.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
delta int- delta (int)
(&mut Pipeline) decr_by
pub fn (p &mut Pipeline) decr_by(key string, delta int)
Purpose
Method on `&mut Pipeline`: decr by.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
delta int- delta (int)
(&mut Pipeline) expire
pub fn (p &mut Pipeline) expire(key string, seconds int)
Purpose
Call `expire` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
seconds int- seconds (int)
(&mut Pipeline) ttl
pub fn (p &mut Pipeline) ttl(key string)
Purpose
Call `ttl` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) hget
pub fn (p &mut Pipeline) hget(key string, field string)
Purpose
Call `hget` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
field string- field (string)
(&mut Pipeline) hset
pub fn (p &mut Pipeline) hset(key string, field string, val string)
Purpose
Call `hset` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
field string- field (string)
val string- value (string)
(&mut Pipeline) hdel
pub fn (p &mut Pipeline) hdel(key string, field string)
Purpose
Call `hdel` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
field string- field (string)
(&mut Pipeline) lpush
pub fn (p &mut Pipeline) lpush(key string, val string)
Purpose
Call `lpush` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
val string- value (string)
(&mut Pipeline) rpush
pub fn (p &mut Pipeline) rpush(key string, val string)
Purpose
Call `rpush` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
val string- value (string)
(&mut Pipeline) lpop
pub fn (p &mut Pipeline) lpop(key string)
Purpose
Call `lpop` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) rpop
pub fn (p &mut Pipeline) rpop(key string)
Purpose
Call `rpop` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
(&mut Pipeline) sadd
pub fn (p &mut Pipeline) sadd(key string, member string)
Purpose
Call `sadd` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
member string- member (string)
(&mut Pipeline) srem
pub fn (p &mut Pipeline) srem(key string, member string)
Purpose
Call `srem` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
member string- member (string)
(&mut Pipeline) zadd
pub fn (p &mut Pipeline) zadd(key string, score f64, member string)
Purpose
Call `zadd` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
score f64- score (f64)
member string- member (string)
(&mut Pipeline) zrem
pub fn (p &mut Pipeline) zrem(key string, member string)
Purpose
Call `zrem` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
member string- member (string)
(&mut Pipeline) zscore
pub fn (p &mut Pipeline) zscore(key string, member string)
Purpose
Call `zscore` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
member string- member (string)
(&mut Pipeline) zrange
pub fn (p &mut Pipeline) zrange(key string, start int, stop int)
Purpose
Call `zrange` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
key string- key (string)
start int- start (int)
stop int- stop (int)
(&mut Pipeline) mget
pub fn (p &mut Pipeline) mget(keys []string)
Purpose
Call `mget` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
keys []string- keys ([]string)
(&mut Pipeline) mset
pub fn (p &mut Pipeline) mset(pairs []string)
Purpose
Call `mset` on `&mut Pipeline`.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
pairs []string- pairs ([]string)
(&mut Client) exec_pipeline
pub fn (c &mut Client) exec_pipeline(p &mut Pipeline) []Value
Purpose
Method on `&mut Client`: exec pipeline. Throws on failure.
Parameters
c &mut Client- receiver &mut Client (exclusive borrow)
p &mut Pipeline- p (exclusive borrow; type &mut Pipeline)
Returns
[]Value — slice result
(&mut Pipeline) exec
pub fn (p &mut Pipeline) exec(c &mut Client) []Value
Purpose
Call `exec` on `&mut Pipeline`. Throws on failure.
Parameters
p &mut Pipeline- receiver &mut Pipeline (exclusive borrow)
c &mut Client- byte or character code (exclusive borrow; type &mut Client)
Returns
[]Value — slice result
struct Pool
pub struct Pool {
pub addr string
pub auth string
pub db int
pub idle chan int
pub max_idle int
}
Purpose
Public struct `Pool`.
Parameters
addr string- address
auth string- field (string)
db int- field (int)
idle chan int- field (channel; type chan int)
max_idle int- field (int)
new_pool
pub fn new_pool(addr string, max_idle int) Pool
Purpose
Construct pool.
Parameters
addr string- address (string)
max_idle int- max_idle (int)
Returns
Pool — a value of this type
new_pool_auth
pub fn new_pool_auth(addr string, auth string, max_idle int) Pool
Purpose
Construct pool auth.
Parameters
addr string- address (string)
auth string- auth (string)
max_idle int- max_idle (int)
Returns
Pool — a value of this type
new_pool_url
pub fn new_pool_url(raw string, max_idle int) Pool
Purpose
Construct pool url.
Parameters
raw string- raw (string)
max_idle int- max_idle (int)
Returns
Pool — a value of this type
(&Pool) get
pub fn (p &Pool) get() Client
Purpose
Call `get` on `&Pool`. Throws on failure.
Parameters
p &Pool- receiver &Pool (borrow)
Returns
Client — a value of this type
(&Pool) put
pub fn (p &Pool) put(c Client)
Purpose
Call `put` on `&Pool`.
Parameters
p &Pool- receiver &Pool (borrow)
c Client- byte or character code (Client)
(&Pool) close
Purpose
Method on `&Pool`: close the resource.
Parameters
p &Pool- receiver &Pool (borrow)
encode_cmd
pub fn encode_cmd(args []string) string
Purpose
Encode.
Parameters
args []string- variadic arguments ([]string)
Returns
string — result string
find_crlf
pub fn find_crlf(s &string) int
Purpose
Find crlf.
Parameters
s &string- source string (borrowed; caller keeps it; type &string)
Returns
int — a value of this type
struct RedisURL
pub struct RedisURL {
pub host string
pub port int
pub addr string
pub password string
pub db int
}
Purpose
Public struct `RedisURL`.
Parameters
host string- host
port int- port
addr string- address
password string- field (string)
db int- field (int)
parse_url
pub fn parse_url(raw string) RedisURL
Purpose
Parse as url.
Parameters
raw string- raw (string)
Returns
RedisURL — a value of this type
const type_str
Purpose
Public constant `type_str`. Value `1`.
Parameters
none
const type_int
Purpose
Public constant `type_int`. Value `2`.
Parameters
none
const type_arr
Purpose
Public constant `type_arr`. Value `3`.
Parameters
none
const type_nil
Purpose
Public constant `type_nil`. Value `4`.
Parameters
none
const type_err
Purpose
Public constant `type_err`. Value `5`.
Parameters
none
const type_bool
Purpose
Public constant `type_bool`. Value `6`.
Parameters
none
const type_map
Purpose
Public constant `type_map`. Value `7`.
Parameters
none
const type_set
Purpose
Public constant `type_set`. Value `8`.
Parameters
none
const type_push
Purpose
Public constant `type_push`. Value `9`.
Parameters
none
const type_double
pub const type_double = 10
Purpose
Public constant `type_double`. Value `10`.
Parameters
none
const type_big_number
pub const type_big_number = 11
Purpose
Public constant `type_big_number`. Value `11`.
Parameters
none
const type_verbatim
pub const type_verbatim = 12
Purpose
Public constant `type_verbatim`. Value `12`.
Parameters
none
struct Value
pub struct Value {
pub typ int
pub str_val string
pub int_val int
pub arr_val []string
pub is_null bool
pub raw string
}
Purpose
Public struct `Value`.
Parameters
typ int- field (int)
str_val string- field (string)
int_val int- field (int)
arr_val []string- field ([]string)
is_null bool- field (bool)
raw string- Complete RESP encoding preserves typed children without recursive structs.
nil_value
Purpose
Nil value.
Parameters
none
Returns
Value — a value of this type
str_value
pub fn str_value(s string) Value
Purpose
Str value.
Parameters
s string- source string (string)
Returns
Value — a value of this type
int_value
pub fn int_value(n int) Value
Purpose
Int value.
Parameters
n int- count, length, or limit (int)
Returns
Value — a value of this type
arr_value
pub fn arr_value(arr []string) Value
Purpose
Arr value.
Parameters
arr []string- slice to operate on ([]string)
Returns
Value — a value of this type
err_value
pub fn err_value(msg string) Value
Purpose
Err value.
Parameters
msg string- message (string)
Returns
Value — a value of this type
bool_value
pub fn bool_value(b bool) Value
Purpose
Bool value.
Parameters
b bool- b (bool)
Returns
Value — a value of this type
(&Value) is_nil
pub fn (v &Value) is_nil() bool
Purpose
Method on `&Value`: whether it is nil.
Parameters
v &Value- receiver &Value (borrow)
Returns
bool — true or false
(&Value) is_err
pub fn (v &Value) is_err() bool
Purpose
Method on `&Value`: whether it is err.
Parameters
v &Value- receiver &Value (borrow)
Returns
bool — true or false
(&Value) as_string
pub fn (v &Value) as_string() string
Purpose
Method on `&Value`: as string. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
Returns
string — result string
(&Value) as_string_or
pub fn (v &Value) as_string_or(def string) string
Purpose
Method on `&Value`: as string or. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
def string- default (string)
Returns
string — result string
(&Value) as_int
pub fn (v &Value) as_int() int
Purpose
Method on `&Value`: as int. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
Returns
int — a value of this type
(&Value) as_bool
pub fn (v &Value) as_bool() bool
Purpose
Method on `&Value`: as bool. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
Returns
bool — true or false
(&Value) elements
pub fn (v &Value) elements() []Value
Purpose
Map elements are alternating keys and values; set/push/array elements keep their own types. Null, error, nested aggregates and empty strings differ. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
Returns
[]Value — slice result
(&Value) as_strings
pub fn (v &Value) as_strings() []string
Purpose
Method on `&Value`: as string slice. Throws on failure.
Parameters
v &Value- receiver &Value (borrow)
Returns
[]string — slice result