XU XUv0.8.8
EN

API

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

import: cassandra #github.com/xulang-org/packages/cassandra

counts: 10 函数, 8 方法, 3 类型, 11 常量, 0 方法集

扩展包 `cassandra #github.com/xulang-org/packages/cassandra`,由模块 github.com/xulang-org/packages 提供。

github.com/xulang-org/packages · 0.1.1 · 安装与使用

struct Client

XuAPI
pub struct Client {
    pub host string
    pub port int
    pub keyspace string
}

用途

公开结构体 `Client`。

参数

host string
主机
port int
端口
keyspace string
字段(string)

new_client

XuAPI
pub fn new_client(endpoint string, keyspace string) Client

用途

构造 client。

参数

endpoint string
endpoint(string)
keyspace string
keyspace(string)

返回

Client — 该类型的值

(Client) read_frame

XuAPI
pub fn (c Client) read_frame(fd int) Frame

用途

`Client` 上的方法:读取frame。失败时 throw。

参数

c Client
接收者 Client(值接收者)
fd int
文件描述符(int)

返回

Frame — 该类型的值

(Client) connect

XuAPI
pub fn (c Client) connect() int

用途

在 `Client` 上调用 `connect`。失败时 throw。

参数

c Client
接收者 Client(值接收者)

返回

int — 该类型的值

(Client) execute_on_fd

XuAPI
pub fn (c Client) execute_on_fd(fd int, cql string) string

用途

`Client` 上的方法:execute于fd。失败时 throw。

参数

c Client
接收者 Client(值接收者)
fd int
文件描述符(int)
cql string
cql(string)

返回

string — 结果字符串

(Client) execute

XuAPI
pub fn (c Client) execute(cql string) string

用途

在 `Client` 上调用 `execute`。失败时 throw。

参数

c Client
接收者 Client(值接收者)
cql string
cql(string)

返回

string — 结果字符串

struct Pool

XuAPI
pub struct Pool {
    pub client Client
    pub idle chan int
    pub max_idle int
}

用途

公开结构体 `Pool`。

参数

client Client
字段(Client)
idle chan int
字段(通道;类型 chan int)
max_idle int
字段(int)

new_pool

XuAPI
pub fn new_pool(endpoint string, keyspace string, max_idle int) Pool

用途

构造 pool。

参数

endpoint string
endpoint(string)
keyspace string
keyspace(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

open_pool

XuAPI
pub fn open_pool(endpoint string, keyspace string, max_idle int) Pool

用途

打开pool。

参数

endpoint string
endpoint(string)
keyspace string
keyspace(string)
max_idle int
max_idle(int)

返回

Pool — 该类型的值

(&Pool) get_conn

XuAPI
pub fn (p &Pool) get_conn() int

用途

`&Pool` 上的方法:读取 conn。

参数

p &Pool
接收者 &Pool(借用)

返回

int — 该类型的值

(&Pool) put_conn

XuAPI
pub fn (p &Pool) put_conn(fd int)

用途

`&Pool` 上的方法:put连接。

参数

p &Pool
接收者 &Pool(借用)
fd int
文件描述符(int)

(&Pool) execute

XuAPI
pub fn (p &Pool) execute(cql string) string

用途

在 `&Pool` 上调用 `execute`。失败时 throw。

参数

p &Pool
接收者 &Pool(借用)
cql string
cql(string)

返回

string — 结果字符串

(&Pool) close

XuAPI
pub fn (p &Pool) close()

用途

`&Pool` 上的方法:关闭资源。

参数

p &Pool
接收者 &Pool(借用)

const opcode_error

XuAPI
pub const opcode_error = 0

用途

公开常量 `opcode_error`。 值为 `0`

参数

无

const opcode_startup

XuAPI
pub const opcode_startup = 1

用途

公开常量 `opcode_startup`。 值为 `1`

参数

无

const opcode_ready

XuAPI
pub const opcode_ready = 2

用途

公开常量 `opcode_ready`。 值为 `2`

参数

无

const opcode_authenticate

XuAPI
pub const opcode_authenticate = 3

用途

公开常量 `opcode_authenticate`。 值为 `3`

参数

无

const opcode_query

XuAPI
pub const opcode_query = 7

用途

公开常量 `opcode_query`。 值为 `7`

参数

无

const opcode_result

XuAPI
pub const opcode_result = 8

用途

公开常量 `opcode_result`。 值为 `8`

参数

无

const result_kind_void

XuAPI
pub const result_kind_void = 1

用途

公开常量 `result_kind_void`。 值为 `1`

参数

无

const result_kind_rows

XuAPI
pub const result_kind_rows = 2

用途

公开常量 `result_kind_rows`。 值为 `2`

参数

无

const result_kind_set_keyspace

XuAPI
pub const result_kind_set_keyspace = 3

用途

公开常量 `result_kind_set_keyspace`。 值为 `3`

参数

无

const result_kind_prepared

XuAPI
pub const result_kind_prepared = 4

用途

公开常量 `result_kind_prepared`。 值为 `4`

参数

无

const result_kind_schema_change

XuAPI
pub const result_kind_schema_change = 5

用途

公开常量 `result_kind_schema_change`。 值为 `5`

参数

无

struct Frame

XuAPI
pub struct Frame {
    pub version int
    pub flags int
    pub stream int
    pub opcode int
    pub body string
}

用途

公开结构体 `Frame`。

参数

version int
字段(int)
flags int
字段(int)
stream int
字段(int)
opcode int
字段(int)
body string
正文

encode_u16

XuAPI
pub fn encode_u16(val int) string

用途

编码。

参数

val int
值(int)

返回

string — 结果字符串

encode_u32

XuAPI
pub fn encode_u32(val int) string

用途

编码。

参数

val int
值(int)

返回

string — 结果字符串

decode_u16

XuAPI
pub fn decode_u16(b1 int, b2 int) int

用途

解码。

参数

b1 int
b1(int)
b2 int
b2(int)

返回

int — 该类型的值

decode_u32

XuAPI
pub fn decode_u32(b1 int, b2 int, b3 int, b4 int) int

用途

解码。

参数

b1 int
b1(int)
b2 int
b2(int)
b3 int
b3(int)
b4 int
b4(int)

返回

int — 该类型的值

build_frame

XuAPI
pub fn build_frame(opcode int, stream int, body string) string

用途

buildframe。

参数

opcode int
opcode(int)
stream int
stream(int)
body string
正文(string)

返回

string — 结果字符串

build_startup_frame

XuAPI
pub fn build_startup_frame() string

用途

buildstartupframe。

参数

无

返回

string — 结果字符串

build_query_frame

XuAPI
pub fn build_query_frame(cql string, stream int) string

用途

build查询串frame。

参数

cql string
cql(string)
stream int
stream(int)

返回

string — 结果字符串