XU XUv0.8.8
中文

API

#github.com/xulang-org/packages/redis

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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
pub struct Pipeline {
    pub raw string
    pub count int
}

Purpose

Public struct `Pipeline`.

Parameters

raw string
field (string)
count int
field (int)

new_pipeline

XuAPI
pub fn new_pipeline() Pipeline

Purpose

Construct pipeline.

Parameters

none

Returns

Pipeline — a value of this type

(&Client) pipeline

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
pub fn (p &mut Pipeline) ping()

Purpose

Call `ping` on `&mut Pipeline`.

Parameters

p &mut Pipeline
receiver &mut Pipeline (exclusive borrow)

(&mut Pipeline) get

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
pub fn (p &Pool) close()

Purpose

Method on `&Pool`: close the resource.

Parameters

p &Pool
receiver &Pool (borrow)

encode_cmd

XuAPI
pub fn encode_cmd(args []string) string

Purpose

Encode.

Parameters

args []string
variadic arguments ([]string)

Returns

string — result string

find_crlf

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
pub const type_str = 1

Purpose

Public constant `type_str`. Value `1`.

Parameters

none

const type_int

XuAPI
pub const type_int = 2

Purpose

Public constant `type_int`. Value `2`.

Parameters

none

const type_arr

XuAPI
pub const type_arr = 3

Purpose

Public constant `type_arr`. Value `3`.

Parameters

none

const type_nil

XuAPI
pub const type_nil = 4

Purpose

Public constant `type_nil`. Value `4`.

Parameters

none

const type_err

XuAPI
pub const type_err = 5

Purpose

Public constant `type_err`. Value `5`.

Parameters

none

const type_bool

XuAPI
pub const type_bool = 6

Purpose

Public constant `type_bool`. Value `6`.

Parameters

none

const type_map

XuAPI
pub const type_map = 7

Purpose

Public constant `type_map`. Value `7`.

Parameters

none

const type_set

XuAPI
pub const type_set = 8

Purpose

Public constant `type_set`. Value `8`.

Parameters

none

const type_push

XuAPI
pub const type_push = 9

Purpose

Public constant `type_push`. Value `9`.

Parameters

none

const type_double

XuAPI
pub const type_double = 10

Purpose

Public constant `type_double`. Value `10`.

Parameters

none

const type_big_number

XuAPI
pub const type_big_number = 11

Purpose

Public constant `type_big_number`. Value `11`.

Parameters

none

const type_verbatim

XuAPI
pub const type_verbatim = 12

Purpose

Public constant `type_verbatim`. Value `12`.

Parameters

none

struct Value

XuAPI
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

XuAPI
pub fn nil_value() Value

Purpose

Nil value.

Parameters

none

Returns

Value — a value of this type

str_value

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
pub fn err_value(msg string) Value

Purpose

Err value.

Parameters

msg string
message (string)

Returns

Value — a value of this type

bool_value

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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

XuAPI
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