driver
XuAPI
pub fn driver() driver.Driver用途
driver,返回 driver.Driver。
参数
无
返回
driver.Driver — 该类型的值
API
#github.com/xulang-org/packages/postgres扩展包 `postgres #github.com/xulang-org/packages/postgres`,由模块 github.com/xulang-org/packages 提供。
github.com/xulang-org/packages · 0.1.1 · 安装与使用
driverpub fn driver() driver.Driverdriver,返回 driver.Driver。
无
driver.Driver — 该类型的值
openpub fn open(dsn string) driver.Conn打开。
dsn stringdriver.Conn — 该类型的值
struct Configpub struct Config {
pub host string
pub port int
pub user string
pub password string
pub database string
pub ssl_mode string
}公开结构体 `Config`。
host stringport intuser stringpassword stringdatabase stringssl_mode stringnew_configpub fn new_config() Config构造 config。
无
Config — 该类型的值
parse_dsnpub fn parse_dsn(dsn string) Config解析为 dsn。失败时 throw。
dsn stringConfig — 该类型的值
struct PostgresDriverpub struct PostgresDriver {
pub tag int
pub dsn string
}公开结构体 `PostgresDriver`。
tag intdsn stringopen_dbpub fn open_db(dsn string) sql.DB打开db。
dsn stringsql.DB — 该类型的值
open_poolpub fn open_pool(dsn string, max_open int, max_idle int) sql.DB打开pool。
dsn stringmax_open intmax_idle intsql.DB — 该类型的值
struct WireResultpub struct WireResult {
pub columns []string
pub cells []string
pub ncols int
pub rows_affected int
pub err string
}公开结构体 `WireResult`。
columns []stringcells []stringncols introws_affected interr stringquery_sqlpub fn query_sql(dsn string, q string) WireResult查询串sql。
dsn stringq stringWireResult — 该类型的值
exec_sqlpub fn exec_sql(dsn string, q string) WireResultexecsql。
dsn stringq stringWireResult — 该类型的值