XU XUv0.8.8
EN

API

#github.com/xulang-org/packages/postgres

import: postgres #github.com/xulang-org/packages/postgres

counts: 8 函数, 0 方法, 3 类型, 0 常量, 0 方法集

扩展包 `postgres #github.com/xulang-org/packages/postgres`,由模块 github.com/xulang-org/packages 提供。

github.com/xulang-org/packages · 0.1.1 · 安装与使用

driver

XuAPI
pub fn driver() driver.Driver

用途

driver,返回 driver.Driver。

参数

无

返回

driver.Driver — 该类型的值

open

XuAPI
pub fn open(dsn string) driver.Conn

用途

打开。

参数

dsn string
dsn(string)

返回

driver.Conn — 该类型的值

struct Config

XuAPI
pub struct Config {
    pub host string
    pub port int
    pub user string
    pub password string
    pub database string
    pub ssl_mode string
}

用途

公开结构体 `Config`。

参数

host string
主机
port int
端口
user string
字段(string)
password string
字段(string)
database string
字段(string)
ssl_mode string
字段(string)

new_config

XuAPI
pub fn new_config() Config

用途

构造 config。

参数

无

返回

Config — 该类型的值

parse_dsn

XuAPI
pub fn parse_dsn(dsn string) Config

用途

解析为 dsn。失败时 throw。

参数

dsn string
dsn(string)

返回

Config — 该类型的值

struct PostgresDriver

XuAPI
pub struct PostgresDriver {
    pub tag int
    pub dsn string
}

用途

公开结构体 `PostgresDriver`。

参数

tag int
字段(int)
dsn string
字段(string)

open_db

XuAPI
pub fn open_db(dsn string) sql.DB

用途

打开db。

参数

dsn string
dsn(string)

返回

sql.DB — 该类型的值

open_pool

XuAPI
pub fn open_pool(dsn string, max_open int, max_idle int) sql.DB

用途

打开pool。

参数

dsn string
dsn(string)
max_open int
max_open(int)
max_idle int
max_idle(int)

返回

sql.DB — 该类型的值

struct WireResult

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

用途

公开结构体 `WireResult`。

参数

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

query_sql

XuAPI
pub fn query_sql(dsn string, q string) WireResult

用途

查询串sql。

参数

dsn string
dsn(string)
q string
q(string)

返回

WireResult — 该类型的值

exec_sql

XuAPI
pub fn exec_sql(dsn string, q string) WireResult

用途

execsql。

参数

dsn string
dsn(string)
q string
q(string)

返回

WireResult — 该类型的值