mydb

package
v0.0.0-...-d74cc4e Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	DB      *sql.DB
	ConnStr string
	// contains filtered or unexported fields
}

Connection 数据库连接

func NewConnection

func NewConnection() *Connection

NewConnection 数据库连接

func (*Connection) Close

func (c *Connection) Close() bool

Close 关闭数据库连接

func (*Connection) Connect

func (c *Connection) Connect() error

Connect 进行连接

func (*Connection) Exec

func (c *Connection) Exec(sqlstr string, args ...interface{}) (sql.Result, error)

Exec 执行语句

func (*Connection) GetConnection

func (c *Connection) GetConnection() error

GetConnection 获取sql连接

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

IsConnected 数据库是否已连接

func (*Connection) IsValid

func (c *Connection) IsValid() bool

IsValid 数据库连接是否有效

func (*Connection) Query

func (c *Connection) Query(sqlstr string, args ...interface{}) (*sql.Rows, error)

Query 查询语句

func (*Connection) SetConnStr

func (c *Connection) SetConnStr(opts config.SQLConnOpt)

SetConnStr 设置数据库连接字符串

Jump to

Keyboard shortcuts

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