XU XUv0.8.8
中文

API

#database/sql

import: #database/sql

counts: 9 fns, 63 methods, 18 types, 8 consts, 0 ifaces

Database API: open, pooling, Conn, transactions, Stmt, and Rows; concrete drivers come from external packages.

const level_default

XuAPI
pub const level_default = 0

Purpose

Public constant `level_default`. Value `0`.

Parameters

none

const level_read_uncommitted

XuAPI
pub const level_read_uncommitted = 1

Purpose

Public constant `level_read_uncommitted`. Value `1`.

Parameters

none

const level_read_committed

XuAPI
pub const level_read_committed = 2

Purpose

Public constant `level_read_committed`. Value `2`.

Parameters

none

const level_write_committed

XuAPI
pub const level_write_committed = 3

Purpose

Public constant `level_write_committed`. Value `3`.

Parameters

none

const level_repeatable_read

XuAPI
pub const level_repeatable_read = 4

Purpose

Public constant `level_repeatable_read`. Value `4`.

Parameters

none

const level_snapshot

XuAPI
pub const level_snapshot = 5

Purpose

Public constant `level_snapshot`. Value `5`.

Parameters

none

const level_serializable

XuAPI
pub const level_serializable = 6

Purpose

Public constant `level_serializable`. Value `6`.

Parameters

none

const level_linearizable

XuAPI
pub const level_linearizable = 7

Purpose

Public constant `level_linearizable`. Value `7`.

Parameters

none

struct TxOptions

XuAPI
pub struct TxOptions {
    pub isolation int
    pub read_only bool
}

Purpose

Public struct `TxOptions`.

Parameters

isolation int
field (int)
read_only bool
field (bool)

struct NamedArg

XuAPI
pub struct NamedArg {
    pub name string
    pub value temp
}

Purpose

Public struct `NamedArg`.

Parameters

name string
name
value temp
field (temp)

struct DBStats

XuAPI
pub struct DBStats {
    pub max_open_connections int
    pub open_connections int
    pub in_use int
    pub idle int
    pub wait_count int
    pub max_idle_closed int
    pub max_idle_time_closed int
    pub max_lifetime_closed int
}

Purpose

`sql.DBStats` (WaitDuration omitted: v1 does not accumulate wait ns).

Parameters

max_open_connections int
field (int)
open_connections int
field (int)
in_use int
field (int)
idle int
field (int)
wait_count int
field (int)
max_idle_closed int
field (int)
max_idle_time_closed int
field (int)
max_lifetime_closed int
field (int)

struct DB

XuAPI
pub struct DB {
    pub drv driver.Driver
    pub dsn string
    pub use_connector int
    pub opener chan ConnSlot
    pub idle chan PooledConn
    pub st chan PoolState
}

Purpose

Public struct `DB`.

Parameters

drv driver.Driver
field (driver.Driver)
dsn string
field (string)
use_connector int
field (int)
opener chan ConnSlot
field (channel; type chan ConnSlot)
idle chan PooledConn
field (channel; type chan PooledConn)
st chan PoolState
field (channel; type chan PoolState)

struct Conn

XuAPI
pub struct Conn {
    pub closed int
    pub created_ns int
    pub idle_ns int
    pub idle chan PooledConn
    pub pst chan PoolState
    pub drv driver.Driver
    pub dsn string
    pub use_connector int
    pub opener chan ConnSlot
}

Purpose

Public struct `Conn`.

Parameters

closed int
field (int)
created_ns int
field (int)
idle_ns int
field (int)
idle chan PooledConn
field (channel; type chan PooledConn)
pst chan PoolState
field (channel; type chan PoolState)
drv driver.Driver
field (driver.Driver)
dsn string
field (string)
use_connector int
field (int)
opener chan ConnSlot
field (channel; type chan ConnSlot)

struct Tx

XuAPI
pub struct Tx {
    pub slot chan PooledConn
    pub dtx driver.Tx
    pub done int
    pub from_pool int
    pub created_ns int
    pub idle_ns int
    pub idle chan PooledConn
    pub pst chan PoolState
    pub drv driver.Driver
    pub dsn string
    pub use_connector int
    pub opener chan ConnSlot
}

Purpose

Public struct `Tx`.

Parameters

slot chan PooledConn
field (channel; type chan PooledConn)
dtx driver.Tx
field (driver.Tx)
done int
field (int)
from_pool int
field (int)
created_ns int
field (int)
idle_ns int
field (int)
idle chan PooledConn
field (channel; type chan PooledConn)
pst chan PoolState
field (channel; type chan PoolState)
drv driver.Driver
field (driver.Driver)
dsn string
field (string)
use_connector int
field (int)
opener chan ConnSlot
field (channel; type chan ConnSlot)

struct Result

XuAPI
pub struct Result {
    pub last_insert_id int
    pub rows_affected int
}

Purpose

Public struct `Result`.

Parameters

last_insert_id int
field (int)
rows_affected int
field (int)

struct NullInt64

XuAPI
pub struct NullInt64 {
    pub v int
    pub valid bool
}

Purpose

Public struct `NullInt64`.

Parameters

v int
value
valid bool
field (bool)

struct NullString

XuAPI
pub struct NullString {
    pub s string
    pub valid bool
}

Purpose

Public struct `NullString`.

Parameters

s string
source string
valid bool
field (bool)

struct NullBool

XuAPI
pub struct NullBool {
    pub v bool
    pub valid bool
}

Purpose

Public struct `NullBool`.

Parameters

v bool
value
valid bool
field (bool)

struct NullFloat64

XuAPI
pub struct NullFloat64 {
    pub v f64
    pub valid bool
}

Purpose

Public struct `NullFloat64`.

Parameters

v f64
value
valid bool
field (bool)

struct NullInt32

XuAPI
pub struct NullInt32 {
    pub v i32
    pub valid bool
}

Purpose

Public struct `NullInt32`.

Parameters

v i32
value
valid bool
field (bool)

struct NullByte

XuAPI
pub struct NullByte {
    pub v u8
    pub valid bool
}

Purpose

Public struct `NullByte`.

Parameters

v u8
value
valid bool
field (bool)

struct NullTime

XuAPI
pub struct NullTime {
    pub t time.Time
    pub valid bool
}

Purpose

Public struct `NullTime`.

Parameters

t time.Time
field (time.Time)
valid bool
field (bool)

struct ColumnType

XuAPI
pub struct ColumnType {
    pub col string
    pub db_type string
    pub length int
    pub length_ok bool
    pub nullable bool
    pub nullable_ok bool
    pub precision int
    pub scale int
    pub precision_ok bool
}

Purpose

Public struct `ColumnType`.

Parameters

col string
field (string)
db_type string
field (string)
length int
field (int)
length_ok bool
field (bool)
nullable bool
field (bool)
nullable_ok bool
field (bool)
precision int
field (int)
scale int
field (int)
precision_ok bool
field (bool)

struct Rows

XuAPI
pub struct Rows {
    pub cols []string
    pub cells []string
    pub cur []string
    pub ncols int
    pub i int
    pub closed int
    pub err string
    pub has int
    pub pooled int
    pub idle chan PooledConn
    pub pst chan PoolState
}

Purpose

Public struct `Rows`.

Parameters

cols []string
field ([]string)
cells []string
field ([]string)
cur []string
field ([]string)
ncols int
field (int)
i int
index or integer
closed int
field (int)
err string
error
has int
field (int)
pooled int
field (int)
idle chan PooledConn
field (channel; type chan PooledConn)
pst chan PoolState
field (channel; type chan PoolState)

struct Row

XuAPI
pub struct Row {
    pub cells []string
    pub err string
}

Purpose

Public struct `Row`.

Parameters

cells []string
field ([]string)
err string
error

struct Stmt

XuAPI
pub struct Stmt {
    pub ds driver.Stmt
    pub qtext string
    pub closed int
    pub from_db int
    pub created_ns int
    pub idle_ns int
    pub idle chan PooledConn
    pub pst chan PoolState
    pub drv driver.Driver
    pub dsn string
    pub use_connector int
    pub opener chan ConnSlot
}

Purpose

Public struct `Stmt`.

Parameters

ds driver.Stmt
field (driver.Stmt)
qtext string
field (string)
closed int
field (int)
from_db int
field (int)
created_ns int
field (int)
idle_ns int
field (int)
idle chan PooledConn
field (channel; type chan PooledConn)
pst chan PoolState
field (channel; type chan PoolState)
drv driver.Driver
field (driver.Driver)
dsn string
field (string)
use_connector int
field (int)
opener chan ConnSlot
field (channel; type chan ConnSlot)

named

XuAPI
pub fn named(name string, value temp) NamedArg

Purpose

named; returns NamedArg.

Parameters

name string
name (string)
value temp
value (temp)

Returns

NamedArg — a value of this type

open

XuAPI
pub fn open(d driver.Driver, name string) DB

Purpose

Open.

Parameters

d driver.Driver
d (driver.Driver)
name string
name (string)

Returns

DB — a value of this type

open_db

XuAPI
pub fn open_db(c driver.Connector) DB

Purpose

Open db.

Parameters

c driver.Connector
byte or character code (driver.Connector)

Returns

DB — a value of this type

open_db_context

XuAPI
pub fn open_db_context(ctx &context.Context, c driver.Connector) DB

Purpose

Open db context. Throws on failure.

Parameters

ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
c driver.Connector
byte or character code (driver.Connector)

Returns

DB — a value of this type

is_no_rows

XuAPI
pub fn is_no_rows(e errors.Error) bool

Purpose

Whether it is no rows.

Parameters

e errors.Error
e (errors.Error)

Returns

bool — true or false

is_tx_done

XuAPI
pub fn is_tx_done(e errors.Error) bool

Purpose

Whether it is tx done.

Parameters

e errors.Error
e (errors.Error)

Returns

bool — true or false

is_conn_done

XuAPI
pub fn is_conn_done(e errors.Error) bool

Purpose

Whether it is conn done.

Parameters

e errors.Error
e (errors.Error)

Returns

bool — true or false

is_bad_conn

XuAPI
pub fn is_bad_conn(e errors.Error) bool

Purpose

Whether it is bad conn.

Parameters

e errors.Error
e (errors.Error)

Returns

bool — true or false

isolation_name

XuAPI
pub fn isolation_name(level int) string

Purpose

Isolation name.

Parameters

level int
level (int)

Returns

string — result string

(&DB) driver

XuAPI
pub fn (db &DB) driver() driver.Driver

Purpose

Call `driver` on `&DB`.

Parameters

db &DB
receiver &DB (borrow)

Returns

driver.Driver — a value of this type

(&DB) ping

XuAPI
pub fn (db &DB) ping() int

Purpose

Call `ping` on `&DB`. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)

Returns

int — a value of this type

(&DB) ping_context

XuAPI
pub fn (db &DB) ping_context(ctx &context.Context) int

Purpose

Method on `&DB`: ping context. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)

Returns

int — a value of this type

(&DB) exec

XuAPI
pub fn (db &DB) exec(query string, args <-> temp) Result

Purpose

Call `exec` on `&DB`. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&DB) exec_context

XuAPI
pub fn (db &DB) exec_context(ctx &context.Context, query string, args <-> temp) Result

Purpose

Method on `&DB`: exec context. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&DB) query

XuAPI
pub fn (db &DB) query(query string, args <-> temp) Rows

Purpose

Call `query` on `&DB`. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&DB) query_context

XuAPI
pub fn (db &DB) query_context(ctx &context.Context, query string, args <-> temp) Rows

Purpose

Method on `&DB`: query context.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&DB) query_row

XuAPI
pub fn (db &DB) query_row(query string, args <-> temp) Row

Purpose

Method on `&DB`: query row.

Parameters

db &DB
receiver &DB (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&DB) query_row_context

XuAPI
pub fn (db &DB) query_row_context(ctx &context.Context, query string, args <-> temp) Row

Purpose

Method on `&DB`: query row context.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&DB) prepare

XuAPI
pub fn (db &DB) prepare(query string) Stmt

Purpose

Call `prepare` on `&DB`.

Parameters

db &DB
receiver &DB (borrow)
query string
query (string)

Returns

Stmt — a value of this type

(&DB) prepare_context

XuAPI
pub fn (db &DB) prepare_context(ctx &context.Context, query string) Stmt

Purpose

Method on `&DB`: prepare context. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)

Returns

Stmt — a value of this type

(&DB) begin

XuAPI
pub fn (db &DB) begin() Tx

Purpose

Call `begin` on `&DB`. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)

Returns

Tx — a value of this type

(&DB) begin_tx

XuAPI
pub fn (db &DB) begin_tx(ctx &context.Context, opts TxOptions) Tx

Purpose

Method on `&DB`: begin tx. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
opts TxOptions
opts (TxOptions)

Returns

Tx — a value of this type

(&DB) set_max_open_conns

XuAPI
pub fn (db &DB) set_max_open_conns(n int)

Purpose

Method on `&DB`: set max open conns.

Parameters

db &DB
receiver &DB (borrow)
n int
count, length, or limit (int)

(&DB) set_max_idle_conns

XuAPI
pub fn (db &DB) set_max_idle_conns(n int)

Purpose

Method on `&DB`: set max idle conns.

Parameters

db &DB
receiver &DB (borrow)
n int
count, length, or limit (int)

(&DB) set_conn_max_lifetime

XuAPI
pub fn (db &DB) set_conn_max_lifetime(d int)

Purpose

Method on `&DB`: set conn max lifetime.

Parameters

db &DB
receiver &DB (borrow)
d int
d (int)

(&DB) set_conn_max_idle_time

XuAPI
pub fn (db &DB) set_conn_max_idle_time(d int)

Purpose

Method on `&DB`: set conn max idle time.

Parameters

db &DB
receiver &DB (borrow)
d int
d (int)

(&DB) stats

XuAPI
pub fn (db &DB) stats() DBStats

Purpose

Call `stats` on `&DB`.

Parameters

db &DB
receiver &DB (borrow)

Returns

DBStats — a value of this type

(&mut DB) close

XuAPI
pub fn (db &mut DB) close() int

Purpose

Method on `&mut DB`: close the resource. Throws on failure.

Parameters

db &mut DB
receiver &mut DB (exclusive borrow)

Returns

int — a value of this type

(&DB) conn

XuAPI
pub fn (db &DB) conn(ctx &context.Context) Conn

Purpose

Method on `&DB`: connection. Throws on failure.

Parameters

db &DB
receiver &DB (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)

Returns

Conn — a value of this type

(&Conn) ping_context

XuAPI
pub fn (c &Conn) ping_context(ctx &context.Context) int

Purpose

Method on `&Conn`: ping context. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)

Returns

int — a value of this type

(&Conn) exec_context

XuAPI
pub fn (c &Conn) exec_context(ctx &context.Context, query string, args <-> temp) Result

Purpose

Method on `&Conn`: exec context. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&Conn) query_context

XuAPI
pub fn (c &Conn) query_context(ctx &context.Context, query string, args <-> temp) Rows

Purpose

Method on `&Conn`: query context. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&Conn) query_row_context

XuAPI
pub fn (c &Conn) query_row_context(ctx &context.Context, query string, args <-> temp) Row

Purpose

Method on `&Conn`: query row context.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&Conn) raw

XuAPI
pub fn (c &Conn) raw() driver.Conn

Purpose

Call `raw` on `&Conn`. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)

Returns

driver.Conn — a value of this type

(&Conn) prepare_context

XuAPI
pub fn (c &Conn) prepare_context(ctx &context.Context, query string) Stmt

Purpose

Method on `&Conn`: prepare context. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)

Returns

Stmt — a value of this type

(&Conn) begin_tx

XuAPI
pub fn (c &Conn) begin_tx(ctx &context.Context, opts TxOptions) Tx

Purpose

Method on `&Conn`: begin tx. Throws on failure.

Parameters

c &Conn
receiver &Conn (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
opts TxOptions
opts (TxOptions)

Returns

Tx — a value of this type

(&mut Conn) close

XuAPI
pub fn (c &mut Conn) close() int

Purpose

Method on `&mut Conn`: close the resource.

Parameters

c &mut Conn
receiver &mut Conn (exclusive borrow)

Returns

int — a value of this type

(Result) last_insert_id

XuAPI
pub fn (r Result) last_insert_id() int

Purpose

Method on `Result`: last insert id.

Parameters

r Result
receiver Result (value receiver)

Returns

int — index; -1 if missing

(Result) rows_affected

XuAPI
pub fn (r Result) rows_affected() int

Purpose

Method on `Result`: rows affected.

Parameters

r Result
receiver Result (value receiver)

Returns

int — a value of this type

(&mut Rows) next

XuAPI
pub fn (r &mut Rows) next() bool

Purpose

Method on `&mut Rows`: take the next item, or end according to this type.

Parameters

r &mut Rows
receiver &mut Rows (exclusive borrow)

Returns

bool — true or false

(&mut Rows) take

XuAPI
pub fn (r &mut Rows) take() []temp

Purpose

Call `take` on `&mut Rows`. Throws on failure.

Parameters

r &mut Rows
receiver &mut Rows (exclusive borrow)

Returns

[]temp — slice result

(&Rows) columns

XuAPI
pub fn (r &Rows) columns() []string

Purpose

Call `columns` on `&Rows`.

Parameters

r &Rows
receiver &Rows (borrow)

Returns

[]string — slice result

(&mut Rows) close

XuAPI
pub fn (r &mut Rows) close()

Purpose

Method on `&mut Rows`: close the resource.

Parameters

r &mut Rows
receiver &mut Rows (exclusive borrow)

(&Rows) err

XuAPI
pub fn (r &Rows) err() string

Purpose

Call `err` on `&Rows`.

Parameters

r &Rows
receiver &Rows (borrow)

Returns

string — result string

(ColumnType) name

XuAPI
pub fn (ct ColumnType) name() string

Purpose

Call `name` on `ColumnType`.

Parameters

ct ColumnType
receiver ColumnType (value receiver)

Returns

string — result string

(ColumnType) database_type_name

XuAPI
pub fn (ct ColumnType) database_type_name() string

Purpose

Method on `ColumnType`: database type name.

Parameters

ct ColumnType
receiver ColumnType (value receiver)

Returns

string — result string

(ColumnType) length

XuAPI
pub fn (ct ColumnType) length() driver.Number

Purpose

Method on `ColumnType`: return the current length.

Parameters

ct ColumnType
receiver ColumnType (value receiver)

Returns

driver.Number — a value of this type

(ColumnType) nullable

XuAPI
pub fn (ct ColumnType) nullable() driver.NullInfo

Purpose

Call `nullable` on `ColumnType`.

Parameters

ct ColumnType
receiver ColumnType (value receiver)

Returns

driver.NullInfo — a value of this type

(ColumnType) decimal_size

XuAPI
pub fn (ct ColumnType) decimal_size() driver.DecimalSize

Purpose

Method on `ColumnType`: decimal size.

Parameters

ct ColumnType
receiver ColumnType (value receiver)

Returns

driver.DecimalSize — a value of this type

(&Rows) column_types

XuAPI
pub fn (r &Rows) column_types() []ColumnType

Purpose

Method on `&Rows`: column types.

Parameters

r &Rows
receiver &Rows (borrow)

Returns

[]ColumnType — slice result

(&mut Rows) next_result_set

XuAPI
pub fn (r &mut Rows) next_result_set() bool

Purpose

Method on `&mut Rows`: next result set.

Parameters

r &mut Rows
receiver &mut Rows (exclusive borrow)

Returns

bool — true or false

(&Row) err

XuAPI
pub fn (r &Row) err() string

Purpose

Call `err` on `&Row`.

Parameters

r &Row
receiver &Row (borrow)

Returns

string — result string

(&Row) take

XuAPI
pub fn (r &Row) take() []temp

Purpose

Call `take` on `&Row`. Throws on failure.

Parameters

r &Row
receiver &Row (borrow)

Returns

[]temp — slice result

(&Tx) exec

XuAPI
pub fn (t &Tx) exec(query string, args <-> temp) Result

Purpose

Call `exec` on `&Tx`. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&Tx) exec_context

XuAPI
pub fn (t &Tx) exec_context(ctx &context.Context, query string, args <-> temp) Result

Purpose

Method on `&Tx`: exec context. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&Tx) query

XuAPI
pub fn (t &Tx) query(query string, args <-> temp) Rows

Purpose

Call `query` on `&Tx`. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&Tx) query_context

XuAPI
pub fn (t &Tx) query_context(ctx &context.Context, query string, args <-> temp) Rows

Purpose

Method on `&Tx`: query context. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&Tx) query_row

XuAPI
pub fn (t &Tx) query_row(query string, args <-> temp) Row

Purpose

Method on `&Tx`: query row.

Parameters

t &Tx
receiver &Tx (borrow)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&Tx) query_row_context

XuAPI
pub fn (t &Tx) query_row_context(ctx &context.Context, query string, args <-> temp) Row

Purpose

Method on `&Tx`: query row context.

Parameters

t &Tx
receiver &Tx (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&Tx) prepare

XuAPI
pub fn (t &Tx) prepare(query string) Stmt

Purpose

Call `prepare` on `&Tx`.

Parameters

t &Tx
receiver &Tx (borrow)
query string
query (string)

Returns

Stmt — a value of this type

(&Tx) prepare_context

XuAPI
pub fn (t &Tx) prepare_context(ctx &context.Context, query string) Stmt

Purpose

Method on `&Tx`: prepare context. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
query string
query (string)

Returns

Stmt — a value of this type

(&Tx) stmt

XuAPI
pub fn (t &Tx) stmt(s &Stmt) Stmt

Purpose

Call `stmt` on `&Tx`.

Parameters

t &Tx
receiver &Tx (borrow)
s &Stmt
source string (borrowed; caller keeps it; type &Stmt)

Returns

Stmt — a value of this type

(&Tx) stmt_context

XuAPI
pub fn (t &Tx) stmt_context(ctx &context.Context, s &Stmt) Stmt

Purpose

Method on `&Tx`: stmt context. Throws on failure.

Parameters

t &Tx
receiver &Tx (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
s &Stmt
source string (borrowed; caller keeps it; type &Stmt)

Returns

Stmt — a value of this type

(&mut Tx) commit

XuAPI
pub fn (t &mut Tx) commit() int

Purpose

Call `commit` on `&mut Tx`. Throws on failure.

Parameters

t &mut Tx
receiver &mut Tx (exclusive borrow)

Returns

int — a value of this type

(&mut Tx) rollback

XuAPI
pub fn (t &mut Tx) rollback() int

Purpose

Call `rollback` on `&mut Tx`. Throws on failure.

Parameters

t &mut Tx
receiver &mut Tx (exclusive borrow)

Returns

int — a value of this type

(&Stmt) exec

XuAPI
pub fn (s &Stmt) exec(args <-> temp) Result

Purpose

Call `exec` on `&Stmt`. Throws on failure.

Parameters

s &Stmt
receiver &Stmt (borrow)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&Stmt) exec_context

XuAPI
pub fn (s &Stmt) exec_context(ctx &context.Context, args <-> temp) Result

Purpose

Method on `&Stmt`: exec context. Throws on failure.

Parameters

s &Stmt
receiver &Stmt (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Result — a value of this type

(&Stmt) query

XuAPI
pub fn (s &Stmt) query(args <-> temp) Rows

Purpose

Call `query` on `&Stmt`. Throws on failure.

Parameters

s &Stmt
receiver &Stmt (borrow)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&Stmt) query_context

XuAPI
pub fn (s &Stmt) query_context(ctx &context.Context, args <-> temp) Rows

Purpose

Method on `&Stmt`: query context. Throws on failure.

Parameters

s &Stmt
receiver &Stmt (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Rows — a value of this type

(&Stmt) query_row

XuAPI
pub fn (s &Stmt) query_row(args <-> temp) Row

Purpose

Method on `&Stmt`: query row.

Parameters

s &Stmt
receiver &Stmt (borrow)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&Stmt) query_row_context

XuAPI
pub fn (s &Stmt) query_row_context(ctx &context.Context, args <-> temp) Row

Purpose

Method on `&Stmt`: query row context.

Parameters

s &Stmt
receiver &Stmt (borrow)
ctx &context.Context
ctx (borrowed; caller keeps it; type &context.Context)
args <-> temp
variadic temp (seen inside the function as []temp)

Returns

Row — a value of this type

(&mut Stmt) close

XuAPI
pub fn (s &mut Stmt) close()

Purpose

Method on `&mut Stmt`: close the resource.

Parameters

s &mut Stmt
receiver &mut Stmt (exclusive borrow)