struct Client
pub struct Client {
pub host string
pub port int
pub keyspace string
}Purpose
Public struct `Client`.
Parameters
hoststring- host
portint- port
keyspacestring- field (string)
API
#github.com/xulang-org/packages/cassandraApache Cassandra & ScyllaDB Native CQL Binary Protocol Driver for Xu Implements CQL Binary Protocol v4 frame serialization, connection pooling, and DDL/DML execution.
github.com/xulang-org/packages · 0.1.1 · Install and use
struct Clientpub struct Client {
pub host string
pub port int
pub keyspace string
}Public struct `Client`.
host stringport intkeyspace stringnew_clientpub fn new_client(endpoint string, keyspace string) ClientConstruct client.
endpoint stringkeyspace stringClient — a value of this type
(Client) read_framepub fn (c Client) read_frame(fd int) FrameMethod on `Client`: read frame. Throws on failure.
c Clientfd intFrame — a value of this type
(Client) connectpub fn (c Client) connect() intCall `connect` on `Client`. Throws on failure.
c Clientint — a value of this type
(Client) execute_on_fdpub fn (c Client) execute_on_fd(fd int, cql string) stringMethod on `Client`: execute on fd. Throws on failure.
c Clientfd intcql stringstring — result string
(Client) executepub fn (c Client) execute(cql string) stringCall `execute` on `Client`. Throws on failure.
c Clientcql stringstring — result string
struct Poolpub struct Pool {
pub client Client
pub idle chan int
pub max_idle int
}Public struct `Pool`.
client Clientidle chan intmax_idle intnew_poolpub fn new_pool(endpoint string, keyspace string, max_idle int) PoolConstruct pool.
endpoint stringkeyspace stringmax_idle intPool — a value of this type
open_poolpub fn open_pool(endpoint string, keyspace string, max_idle int) PoolOpen pool.
endpoint stringkeyspace stringmax_idle intPool — a value of this type
(&Pool) get_connpub fn (p &Pool) get_conn() intMethod on `&Pool`: read conn.
p &Poolint — a value of this type
(&Pool) put_connpub fn (p &Pool) put_conn(fd int)Method on `&Pool`: put connection.
p &Poolfd int(&Pool) executepub fn (p &Pool) execute(cql string) stringCall `execute` on `&Pool`. Throws on failure.
p &Poolcql stringstring — result string
(&Pool) closepub fn (p &Pool) close()Method on `&Pool`: close the resource.
p &Poolconst opcode_errorpub const opcode_error = 0Public constant `opcode_error`. Value `0`.
none
const opcode_startuppub const opcode_startup = 1Public constant `opcode_startup`. Value `1`.
none
const opcode_readypub const opcode_ready = 2Public constant `opcode_ready`. Value `2`.
none
const opcode_authenticatepub const opcode_authenticate = 3Public constant `opcode_authenticate`. Value `3`.
none
const opcode_querypub const opcode_query = 7Public constant `opcode_query`. Value `7`.
none
const opcode_resultpub const opcode_result = 8Public constant `opcode_result`. Value `8`.
none
const result_kind_voidpub const result_kind_void = 1Public constant `result_kind_void`. Value `1`.
none
const result_kind_rowspub const result_kind_rows = 2Public constant `result_kind_rows`. Value `2`.
none
const result_kind_set_keyspacepub const result_kind_set_keyspace = 3Public constant `result_kind_set_keyspace`. Value `3`.
none
const result_kind_preparedpub const result_kind_prepared = 4Public constant `result_kind_prepared`. Value `4`.
none
const result_kind_schema_changepub const result_kind_schema_change = 5Public constant `result_kind_schema_change`. Value `5`.
none
struct Framepub struct Frame {
pub version int
pub flags int
pub stream int
pub opcode int
pub body string
}Public struct `Frame`.
version intflags intstream intopcode intbody stringencode_u16pub fn encode_u16(val int) stringEncode.
val intstring — result string
encode_u32pub fn encode_u32(val int) stringEncode.
val intstring — result string
decode_u16pub fn decode_u16(b1 int, b2 int) intDecode.
b1 intb2 intint — a value of this type
decode_u32pub fn decode_u32(b1 int, b2 int, b3 int, b4 int) intDecode.
b1 intb2 intb3 intb4 intint — a value of this type
build_framepub fn build_frame(opcode int, stream int, body string) stringBuild frame.
opcode intstream intbody stringstring — result string
build_startup_framepub fn build_startup_frame() stringBuild startup frame.
none
string — result string
build_query_framepub fn build_query_frame(cql string, stream int) stringBuild query frame.
cql stringstream intstring — result string