XU XUv0.8.8
EN

API

#database/sql/driver

import: #database/sql/driver

counts: 7 函数, 0 方法, 6 类型, 0 常量, 5 方法集

驱动快照 RowsResult 与 Conn/Stmt/Tx/Driver。

struct NamedValue

XuAPI
pub struct NamedValue {
    pub name string
    pub ordinal int
    pub value temp
}

用途

公开结构体 `NamedValue`。

参数

name string
名字
ordinal int
字段(int)
value temp
字段(temp)

struct ExecResult

XuAPI
pub struct ExecResult {
    pub last_insert_id int
    pub rows_affected int
    pub err string
}

用途

公开结构体 `ExecResult`。

参数

last_insert_id int
字段(int)
rows_affected int
字段(int)
err string
错误

struct RowsResult

XuAPI
pub struct RowsResult {
    pub columns []string
    pub cells []string
    pub ncols int
    pub err string
}

用途

公开结构体 `RowsResult`。

参数

columns []string
字段([]string)
cells []string
字段([]string)
ncols int
字段(int)
err string
错误

struct Number

XuAPI
pub struct Number {
    pub n int
    pub ok bool
}

用途

公开结构体 `Number`。

参数

n int
数量、长度或上限
ok bool
字段(bool)

struct NullInfo

XuAPI
pub struct NullInfo {
    pub nullable bool
    pub ok bool
}

用途

公开结构体 `NullInfo`。

参数

nullable bool
字段(bool)
ok bool
字段(bool)

struct DecimalSize

XuAPI
pub struct DecimalSize {
    pub precision int
    pub scale int
    pub ok bool
}

用途

公开结构体 `DecimalSize`。

参数

precision int
字段(int)
scale int
字段(int)
ok bool
字段(bool)

struct@ Stmt

XuAPI
struct@ Stmt {
    fn num_input() int
    fn exec([]NamedValue) ExecResult
    fn query([]NamedValue) RowsResult
    fn close() string
}

用途

方法集约束 `Stmt`。实现类型须提供下列方法。不是接口值。

参数

num_input fn num_input() int
`Stmt` 上的方法:分子input。
exec fn exec([]NamedValue) ExecResult
在 `Stmt` 上调用 `exec`。
query fn query([]NamedValue) RowsResult
`Stmt` 上的方法:查询串。
close fn close() string
`Stmt` 上的方法:关闭资源。

(Stmt) num_input

XuAPI
fn num_input() int

用途

`Stmt` 上的方法:分子input。

参数

self Self
接收者 Self(值接收者)

返回

int — 该类型的值

(Stmt) exec

XuAPI
fn exec([]NamedValue) ExecResult

用途

在 `Stmt` 上调用 `exec`。

参数

self Self
接收者 Self(值接收者)
namedValue []NamedValue
namedValue([]NamedValue)

返回

ExecResult — 该类型的值

(Stmt) query

XuAPI
fn query([]NamedValue) RowsResult

用途

`Stmt` 上的方法:查询串。

参数

self Self
接收者 Self(值接收者)
namedValue []NamedValue
namedValue([]NamedValue)

返回

RowsResult — 该类型的值

(Stmt) close

XuAPI
fn close() string

用途

`Stmt` 上的方法:关闭资源。

参数

self Self
接收者 Self(值接收者)

返回

string — 结果字符串

struct@ Tx

XuAPI
struct@ Tx {
    fn commit() string
    fn rollback() string
}

用途

方法集约束 `Tx`。实现类型须提供下列方法。不是接口值。

参数

commit fn commit() string
在 `Tx` 上调用 `commit`。
rollback fn rollback() string
在 `Tx` 上调用 `rollback`。

(Tx) commit

XuAPI
fn commit() string

用途

在 `Tx` 上调用 `commit`。

参数

self Self
接收者 Self(值接收者)

返回

string — 结果字符串

(Tx) rollback

XuAPI
fn rollback() string

用途

在 `Tx` 上调用 `rollback`。

参数

self Self
接收者 Self(值接收者)

返回

string — 结果字符串

struct@ Conn

XuAPI
struct@ Conn {
    fn ping() string
    fn exec(string, []NamedValue) ExecResult
    fn query(string, []NamedValue) RowsResult
    fn close() string
    fn dup() Conn
    fn prepare(string) Stmt
    fn prepare_context(&context.Context, string) Stmt
    fn begin() Tx
    fn begin_tx(int, bool) Tx
    fn reset_session(&context.Context) string
    fn is_valid() bool
}

用途

方法集约束 `Conn`。实现类型须提供下列方法。不是接口值。

参数

ping fn ping() string
在 `Conn` 上调用 `ping`。
exec fn exec(string, []NamedValue) ExecResult
在 `Conn` 上调用 `exec`。
query fn query(string, []NamedValue) RowsResult
`Conn` 上的方法:查询串。
close fn close() string
`Conn` 上的方法:关闭资源。
dup fn dup() Conn
在 `Conn` 上调用 `dup`。
prepare fn prepare(string) Stmt
在 `Conn` 上调用 `prepare`。
prepare_context fn prepare_context(&context.Context, string) Stmt
`Conn` 上的方法:prepare上下文。
begin fn begin() Tx
在 `Conn` 上调用 `begin`。
begin_tx fn begin_tx(int, bool) Tx
`Conn` 上的方法:begintx。
reset_session fn reset_session(&context.Context) string
`Conn` 上的方法:重置session。
is_valid fn is_valid() bool
`Conn` 上的方法:判断是否 valid。

(Conn) ping

XuAPI
fn ping() string

用途

在 `Conn` 上调用 `ping`。

参数

self Self
接收者 Self(值接收者)

返回

string — 结果字符串

(Conn) exec

XuAPI
fn exec(string, []NamedValue) ExecResult

用途

在 `Conn` 上调用 `exec`。

参数

self Self
接收者 Self(值接收者)
string string
string(string)
namedValue []NamedValue
namedValue([]NamedValue)

返回

ExecResult — 该类型的值

(Conn) query

XuAPI
fn query(string, []NamedValue) RowsResult

用途

`Conn` 上的方法:查询串。

参数

self Self
接收者 Self(值接收者)
string string
string(string)
namedValue []NamedValue
namedValue([]NamedValue)

返回

RowsResult — 该类型的值

(Conn) close

XuAPI
fn close() string

用途

`Conn` 上的方法:关闭资源。

参数

self Self
接收者 Self(值接收者)

返回

string — 结果字符串

(Conn) dup

XuAPI
fn dup() Conn

用途

在 `Conn` 上调用 `dup`。

参数

self Self
接收者 Self(值接收者)

返回

Conn — 该类型的值

(Conn) prepare

XuAPI
fn prepare(string) Stmt

用途

在 `Conn` 上调用 `prepare`。

参数

self Self
接收者 Self(值接收者)
string string
string(string)

返回

Stmt — 该类型的值

(Conn) prepare_context

XuAPI
fn prepare_context(&context.Context, string) Stmt

用途

`Conn` 上的方法:prepare上下文。

参数

self Self
接收者 Self(值接收者)
context &context.Context
context(借用,调用方仍持有;类型 &context.Context)
string string
string(string)

返回

Stmt — 该类型的值

(Conn) begin

XuAPI
fn begin() Tx

用途

在 `Conn` 上调用 `begin`。

参数

self Self
接收者 Self(值接收者)

返回

Tx — 该类型的值

(Conn) begin_tx

XuAPI
fn begin_tx(int, bool) Tx

用途

`Conn` 上的方法:begintx。

参数

self Self
接收者 Self(值接收者)
int int
int(int)
bool bool
bool(bool)

返回

Tx — 该类型的值

(Conn) reset_session

XuAPI
fn reset_session(&context.Context) string

用途

`Conn` 上的方法:重置session。

参数

self Self
接收者 Self(值接收者)
context &context.Context
context(借用,调用方仍持有;类型 &context.Context)

返回

string — 结果字符串

(Conn) is_valid

XuAPI
fn is_valid() bool

用途

`Conn` 上的方法:判断是否 valid。

参数

self Self
接收者 Self(值接收者)

返回

bool — 是否成立

struct@ Driver

XuAPI
struct@ Driver {
    fn open(string) Conn
    fn dup() Driver
}

用途

方法集约束 `Driver`。实现类型须提供下列方法。不是接口值。

参数

open fn open(string) Conn
`Driver` 上的方法:打开。
dup fn dup() Driver
在 `Driver` 上调用 `dup`。

(Driver) open

XuAPI
fn open(string) Conn

用途

`Driver` 上的方法:打开。

参数

self Self
接收者 Self(值接收者)
string string
string(string)

返回

Conn — 该类型的值

(Driver) dup

XuAPI
fn dup() Driver

用途

在 `Driver` 上调用 `dup`。

参数

self Self
接收者 Self(值接收者)

返回

Driver — 该类型的值

struct@ Connector

XuAPI
struct@ Connector {
    fn connect(&context.Context) Conn
    fn driver() Driver
}

用途

方法集约束 `Connector`。实现类型须提供下列方法。不是接口值。

参数

connect fn connect(&context.Context) Conn
在 `Connector` 上调用 `connect`。
driver fn driver() Driver
在 `Connector` 上调用 `driver`。

(Connector) connect

XuAPI
fn connect(&context.Context) Conn

用途

在 `Connector` 上调用 `connect`。

参数

self Self
接收者 Self(值接收者)
context &context.Context
context(借用,调用方仍持有;类型 &context.Context)

返回

Conn — 该类型的值

(Connector) driver

XuAPI
fn driver() Driver

用途

在 `Connector` 上调用 `driver`。

参数

self Self
接收者 Self(值接收者)

返回

Driver — 该类型的值

encode_value

XuAPI
pub fn encode_value(v temp) string

用途

编码。

参数

v temp
值(temp)

返回

string — 结果字符串

decode_value

XuAPI
pub fn decode_value(s string) temp

用途

解码。

参数

s string
源字符串(string)

返回

temp — 该类型的值

exec_ok

XuAPI
pub fn exec_ok(id int, n int) ExecResult

用途

execok。

参数

id int
id(int)
n int
数量、长度或上限(int)

返回

ExecResult — 该类型的值

exec_err

XuAPI
pub fn exec_err(msg string) ExecResult

用途

execerr。

参数

msg string
消息(string)

返回

ExecResult — 该类型的值

rows_err

XuAPI
pub fn rows_err(msg string) RowsResult

用途

rowserr。

参数

msg string
消息(string)

返回

RowsResult — 该类型的值

err_bad_conn

XuAPI
pub fn err_bad_conn() string

用途

errbad连接。

参数

无

返回

string — 结果字符串

is_bad_conn

XuAPI
pub fn is_bad_conn(msg string) bool

用途

判断是否 bad conn。

参数

msg string
消息(string)

返回

bool — 是否成立