pg

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*sql.DB
}

func Open

func Open(host string, port int, user string, passwd string, dbname string) (db Conn, err error)

Open(主机地址,端口号(int),用户名,密码,数据库名) 自带Ping()尝试连接数据库

func (*Conn) Close

func (db *Conn) Close() (err error)

可能会用到的Close 直接调用DB.Close(),未做处理。

func (*Conn) Exec

func (db *Conn) Exec(sql string, args ...any) (sql.Result, error)

直接调用的DB.Exec,未做处理。 TODO 考虑将返回改为仅error,考虑因素,是否有时会使用到sql.Result

func (*Conn) Query

func (db *Conn) Query(sql string, args ...any) (result []map[string]any, err error)

Query返回一个map[string]any的切片,[]byte已经转为string

func (*Conn) QueryRow

func (db *Conn) QueryRow(sql string, args ...any) (result map[string]any, err error)

同Query,仅返回第一行结果。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL