struct NamedValue
pub struct NamedValue {
pub name string
pub ordinal int
pub value temp
}用途
公开结构体 `NamedValue`。
参数
namestring- 名字
ordinalint- 字段(int)
valuetemp- 字段(temp)
API
#database/sql/driver驱动快照 RowsResult 与 Conn/Stmt/Tx/Driver。
struct NamedValuepub struct NamedValue {
pub name string
pub ordinal int
pub value temp
}公开结构体 `NamedValue`。
name stringordinal intvalue tempstruct ExecResultpub struct ExecResult {
pub last_insert_id int
pub rows_affected int
pub err string
}公开结构体 `ExecResult`。
last_insert_id introws_affected interr stringstruct RowsResultpub struct RowsResult {
pub columns []string
pub cells []string
pub ncols int
pub err string
}公开结构体 `RowsResult`。
columns []stringcells []stringncols interr stringstruct Numberpub struct Number {
pub n int
pub ok bool
}公开结构体 `Number`。
n intok boolstruct NullInfopub struct NullInfo {
pub nullable bool
pub ok bool
}公开结构体 `NullInfo`。
nullable boolok boolstruct DecimalSizepub struct DecimalSize {
pub precision int
pub scale int
pub ok bool
}公开结构体 `DecimalSize`。
precision intscale intok boolstruct@ Stmtstruct@ Stmt {
fn num_input() int
fn exec([]NamedValue) ExecResult
fn query([]NamedValue) RowsResult
fn close() string
}方法集约束 `Stmt`。实现类型须提供下列方法。不是接口值。
num_input fn num_input() intexec fn exec([]NamedValue) ExecResultquery fn query([]NamedValue) RowsResultclose fn close() string(Stmt) num_inputfn num_input() int`Stmt` 上的方法:分子input。
self Selfint — 该类型的值
(Stmt) execfn exec([]NamedValue) ExecResult在 `Stmt` 上调用 `exec`。
self SelfnamedValue []NamedValueExecResult — 该类型的值
(Stmt) queryfn query([]NamedValue) RowsResult`Stmt` 上的方法:查询串。
self SelfnamedValue []NamedValueRowsResult — 该类型的值
(Stmt) closefn close() string`Stmt` 上的方法:关闭资源。
self Selfstring — 结果字符串
struct@ Txstruct@ Tx {
fn commit() string
fn rollback() string
}方法集约束 `Tx`。实现类型须提供下列方法。不是接口值。
commit fn commit() stringrollback fn rollback() string(Tx) commitfn commit() string在 `Tx` 上调用 `commit`。
self Selfstring — 结果字符串
(Tx) rollbackfn rollback() string在 `Tx` 上调用 `rollback`。
self Selfstring — 结果字符串
struct@ Connstruct@ 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() stringexec fn exec(string, []NamedValue) ExecResultquery fn query(string, []NamedValue) RowsResultclose fn close() stringdup fn dup() Connprepare fn prepare(string) Stmtprepare_context fn prepare_context(&context.Context, string) Stmtbegin fn begin() Txbegin_tx fn begin_tx(int, bool) Txreset_session fn reset_session(&context.Context) stringis_valid fn is_valid() bool(Conn) pingfn ping() string在 `Conn` 上调用 `ping`。
self Selfstring — 结果字符串
(Conn) execfn exec(string, []NamedValue) ExecResult在 `Conn` 上调用 `exec`。
self Selfstring stringnamedValue []NamedValueExecResult — 该类型的值
(Conn) queryfn query(string, []NamedValue) RowsResult`Conn` 上的方法:查询串。
self Selfstring stringnamedValue []NamedValueRowsResult — 该类型的值
(Conn) closefn close() string`Conn` 上的方法:关闭资源。
self Selfstring — 结果字符串
(Conn) dupfn dup() Conn在 `Conn` 上调用 `dup`。
self SelfConn — 该类型的值
(Conn) preparefn prepare(string) Stmt在 `Conn` 上调用 `prepare`。
self Selfstring stringStmt — 该类型的值
(Conn) prepare_contextfn prepare_context(&context.Context, string) Stmt`Conn` 上的方法:prepare上下文。
self Selfcontext &context.Contextstring stringStmt — 该类型的值
(Conn) beginfn begin() Tx在 `Conn` 上调用 `begin`。
self SelfTx — 该类型的值
(Conn) begin_txfn begin_tx(int, bool) Tx`Conn` 上的方法:begintx。
self Selfint intbool boolTx — 该类型的值
(Conn) reset_sessionfn reset_session(&context.Context) string`Conn` 上的方法:重置session。
self Selfcontext &context.Contextstring — 结果字符串
(Conn) is_validfn is_valid() bool`Conn` 上的方法:判断是否 valid。
self Selfbool — 是否成立
struct@ Driverstruct@ Driver {
fn open(string) Conn
fn dup() Driver
}方法集约束 `Driver`。实现类型须提供下列方法。不是接口值。
open fn open(string) Conndup fn dup() Driver(Driver) openfn open(string) Conn`Driver` 上的方法:打开。
self Selfstring stringConn — 该类型的值
(Driver) dupfn dup() Driver在 `Driver` 上调用 `dup`。
self SelfDriver — 该类型的值
struct@ Connectorstruct@ Connector {
fn connect(&context.Context) Conn
fn driver() Driver
}方法集约束 `Connector`。实现类型须提供下列方法。不是接口值。
connect fn connect(&context.Context) Conndriver fn driver() Driver(Connector) connectfn connect(&context.Context) Conn在 `Connector` 上调用 `connect`。
self Selfcontext &context.ContextConn — 该类型的值
(Connector) driverfn driver() Driver在 `Connector` 上调用 `driver`。
self SelfDriver — 该类型的值
encode_valuepub fn encode_value(v temp) string编码。
v tempstring — 结果字符串
decode_valuepub fn decode_value(s string) temp解码。
s stringtemp — 该类型的值
exec_okpub fn exec_ok(id int, n int) ExecResultexecok。
id intn intExecResult — 该类型的值
exec_errpub fn exec_err(msg string) ExecResultexecerr。
msg stringExecResult — 该类型的值
rows_errpub fn rows_err(msg string) RowsResultrowserr。
msg stringRowsResult — 该类型的值
err_bad_connpub fn err_bad_conn() stringerrbad连接。
无
string — 结果字符串
is_bad_connpub fn is_bad_conn(msg string) bool判断是否 bad conn。
msg stringbool — 是否成立